Text Generation
Transformers
Safetensors
English
gpt2
materials-science
crystallography
generative-ai
inverse-design
chemistry
unconditional
text-generation-inference
Instructions to use c-bone/CrystaLLM-pi_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use c-bone/CrystaLLM-pi_base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="c-bone/CrystaLLM-pi_base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("c-bone/CrystaLLM-pi_base") model = AutoModelForCausalLM.from_pretrained("c-bone/CrystaLLM-pi_base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use c-bone/CrystaLLM-pi_base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "c-bone/CrystaLLM-pi_base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "c-bone/CrystaLLM-pi_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/c-bone/CrystaLLM-pi_base
- SGLang
How to use c-bone/CrystaLLM-pi_base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "c-bone/CrystaLLM-pi_base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "c-bone/CrystaLLM-pi_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "c-bone/CrystaLLM-pi_base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "c-bone/CrystaLLM-pi_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use c-bone/CrystaLLM-pi_base with Docker Model Runner:
docker model run hf.co/c-bone/CrystaLLM-pi_base
Trim model card to details, uses, limits, pointers, citation
Browse files
README.md
CHANGED
|
@@ -55,36 +55,9 @@ The model is intended for:
|
|
| 55 |
- **Training Distribution:** The model reflects the biases present in the LeMaterial dataset. It is most effective at generating structures similar to known stable inorganic compounds.
|
| 56 |
- **Validity:** While it learns CIF syntax reliably, it may still generate physically invalid structures (e.g., overlapping atoms) or chemically unstable compositions.
|
| 57 |
|
| 58 |
-
##
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
## Training Details
|
| 63 |
-
|
| 64 |
-
### Training Data
|
| 65 |
-
|
| 66 |
-
The model was pre-trained on the **LeMaterial** dataset (specifically `c-bone/lematerial_clean`), a large-scale collection of ~4.35 million augmented CIFs derived from major materials databases.
|
| 67 |
-
|
| 68 |
-
- **Source:** LeMaterial (via `c-bone/lematerial_clean`)
|
| 69 |
-
- **Preprocessing:** CIFs are deduplicated, augmented (with symmetry operations), and tokenized.
|
| 70 |
-
|
| 71 |
-
### Training Procedure
|
| 72 |
-
|
| 73 |
-
- **Architecture:** GPT-2 Small (~25.9M parameters).
|
| 74 |
-
- **Objective:** Causal Language Modeling (Next-token prediction).
|
| 75 |
-
- **Loss Function:** Cross-entropy with specific weighting for fixed syntax tokens to accelerate learning of the CIF format.
|
| 76 |
-
|
| 77 |
-
## Evaluation
|
| 78 |
-
|
| 79 |
-
### Metrics
|
| 80 |
-
|
| 81 |
-
The model is evaluated based on:
|
| 82 |
-
1. **Validity:** The rate at which generated sequences can be parsed as valid CIF files.
|
| 83 |
-
2. **Structural Consistency:** Adherence to space group symmetry and reasonable bond lengths.
|
| 84 |
-
|
| 85 |
-
### Results
|
| 86 |
-
|
| 87 |
-
The base model achieves high validity rates and effectively learns to generate chemically plausible structures, serving as a foundation for downstream property-conditioning tasks.
|
| 88 |
|
| 89 |
## Citation
|
| 90 |
|
|
|
|
| 55 |
- **Training Distribution:** The model reflects the biases present in the LeMaterial dataset. It is most effective at generating structures similar to known stable inorganic compounds.
|
| 56 |
- **Validity:** While it learns CIF syntax reliably, it may still generate physically invalid structures (e.g., overlapping atoms) or chemically unstable compositions.
|
| 57 |
|
| 58 |
+
## Getting started
|
| 59 |
|
| 60 |
+
Generation: [`T2_load_and_generate.ipynb`](https://github.com/C-Bone-UCL/CrystaLLM-pi/blob/main/notebooks/T2_load_and_generate.ipynb). Finetuning onto a property: [`T1_finetune_density_example.ipynb`](https://github.com/C-Bone-UCL/CrystaLLM-pi/blob/main/notebooks/T1_finetune_density_example.ipynb).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
## Citation
|
| 63 |
|