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_mp_20_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use c-bone/CrystaLLM-pi_mp_20_base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="c-bone/CrystaLLM-pi_mp_20_base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("c-bone/CrystaLLM-pi_mp_20_base") model = AutoModelForCausalLM.from_pretrained("c-bone/CrystaLLM-pi_mp_20_base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use c-bone/CrystaLLM-pi_mp_20_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_mp_20_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_mp_20_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/c-bone/CrystaLLM-pi_mp_20_base
- SGLang
How to use c-bone/CrystaLLM-pi_mp_20_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_mp_20_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_mp_20_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_mp_20_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_mp_20_base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use c-bone/CrystaLLM-pi_mp_20_base with Docker Model Runner:
docker model run hf.co/c-bone/CrystaLLM-pi_mp_20_base
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: mit
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- materials-science
|
| 8 |
+
- crystallography
|
| 9 |
+
- generative-ai
|
| 10 |
+
- inverse-design
|
| 11 |
+
- chemistry
|
| 12 |
+
- unconditional
|
| 13 |
+
datasets:
|
| 14 |
+
- c-bone/mp_20
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Model Card for mp_20_base
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
### Model Description
|
| 23 |
+
|
| 24 |
+
**mp_20_base** is an unconditional generative model designed for the generation of valid inorganic crystal structures. It serves as a foundational pre-trained model for the `CrystaLLM-pi` framework, specifically optimized for smaller unit cells. Based on a GPT-2 decoder-only architecture, it is trained on a corpus of Crystallographic Information Files (CIFs) to learn the syntax, symmetry, and chemical rules governing crystalline matter.
|
| 25 |
+
|
| 26 |
+
This model does not accept property conditioning vectors. It generates structures based on text prompts (e.g., chemical composition or space group) or unconditionally (ab-initio generation).
|
| 27 |
+
|
| 28 |
+
- **Developed by:** Bone et al. (University College London)
|
| 29 |
+
- **Model type:** Autoregressive Transformer (GPT-2)
|
| 30 |
+
- **Language(s):** CIF (Crystallographic Information File) syntax
|
| 31 |
+
- **License:** MIT
|
| 32 |
+
|
| 33 |
+
### Model Sources
|
| 34 |
+
|
| 35 |
+
- **Repository:** [GitHub: CrystaLLM-pi](https://github.com/C-Bone-UCL/CrystaLLM-pi)
|
| 36 |
+
- **Paper:** [Discovery and recovery of crystalline materials with property-conditioned transformers (arXiv:2511.21299)](https://arxiv.org/abs/2511.21299)
|
| 37 |
+
- **Dataset:** [HuggingFace: c-bone/mp_20](https://huggingface.co/datasets/c-bone/mp_20)
|
| 38 |
+
|
| 39 |
+
## Uses
|
| 40 |
+
|
| 41 |
+
### Direct Use
|
| 42 |
+
|
| 43 |
+
The model is intended for:
|
| 44 |
+
1. **Unconditional Generation:** Exploring the general chemical space of stable crystals with 20 atoms or fewer in the unit cell.
|
| 45 |
+
2. **Composition/Space Group Completion:** Generating valid structures given a partial prompt (e.g., a chemical formula).
|
| 46 |
+
3. **Fine-tuning base:** Serving as the pre-trained initialization for property-conditional models.
|
| 47 |
+
|
| 48 |
+
### Out-of-Scope Use
|
| 49 |
+
|
| 50 |
+
- **Property Conditioning:** This model cannot be steered by properties like band gap or density. Use the specific fine-tuned variants for those tasks.
|
| 51 |
+
- **Large Unit Cells:** The model is strictly trained on and intended for unit cells containing 20 atoms or fewer.
|
| 52 |
+
|
| 53 |
+
## Bias, Risks, and Limitations
|
| 54 |
+
|
| 55 |
+
- **Training Distribution:** The model reflects the biases present in the Materials Project dataset. It is biased toward theoretical, DFT-relaxed inorganic compounds rather than experimentally synthesized disordered structures.
|
| 56 |
+
- **Size Constraint Bias:** Because it is trained exclusively on the `mp_20` subset, the model has a strong prior for generating small, highly symmetric unit cells (≤ 20 atoms) and will struggle to extrapolate to larger, more complex systems.
|
| 57 |
+
- **Validity:** While it learns CIF syntax robustly, it may still generate physically invalid structures (e.g., overlapping atoms) or chemically unstable compositions.
|
| 58 |
+
|
| 59 |
+
## Training Details
|
| 60 |
+
|
| 61 |
+
### Training Data
|
| 62 |
+
|
| 63 |
+
The model was pre-trained on the **mp_20** dataset (`c-bone/mp_20`), a curated subset of the Materials Project database restricted to crystal structures containing 20 atoms or fewer per unit cell.
|
| 64 |
+
|
| 65 |
+
- **Source:** Materials Project (via `c-bone/mp_20`)
|
| 66 |
+
- **Preprocessing:** CIFs are filtered for size (≤ 20 atoms), deduplicated, augmented (with symmetry operations and fractional coordinate shifts), and tokenized.
|
| 67 |
+
|
| 68 |
+
### Training Procedure
|
| 69 |
+
|
| 70 |
+
- **Architecture:** GPT-2 Small (~25.9M parameters).
|
| 71 |
+
- **Objective:** Causal Language Modeling (Next-token prediction).
|
| 72 |
+
- **Loss Function:** Cross-entropy with specific weighting for fixed syntax tokens to accelerate learning of the CIF format.
|
| 73 |
+
|
| 74 |
+
## Evaluation
|
| 75 |
+
|
| 76 |
+
### Metrics
|
| 77 |
+
|
| 78 |
+
The model is evaluated based on:
|
| 79 |
+
1. **Validity:** The rate at which generated sequences can be parsed as valid CIF files.
|
| 80 |
+
2. **Structural Consistency:** Adherence to space group symmetry and reasonable bond lengths.
|
| 81 |
+
|
| 82 |
+
### Results
|
| 83 |
+
|
| 84 |
+
The base model achieves high validity rates for small unit cells and effectively learns to generate chemically plausible structures, serving as a robust foundation for downstream tasks requiring rigid size constraints.
|
| 85 |
+
|
| 86 |
+
## Citation
|
| 87 |
+
|
| 88 |
+
```bibtex
|
| 89 |
+
@misc{bone2025discoveryrecoverycrystallinematerials,
|
| 90 |
+
title={Discovery and recovery of crystalline materials with property-conditioned transformers},
|
| 91 |
+
author={Cyprien Bone and Matthew Walker and Kuangdai Leng and Luis M. Antunes and Ricardo Grau-Crespo and Amil Aligayev and Javier Dominguez and Keith T. Butler},
|
| 92 |
+
year={2025},
|
| 93 |
+
eprint={2511.21299},
|
| 94 |
+
archivePrefix={arXiv},
|
| 95 |
+
primaryClass={cond-mat.mtrl-sci},
|
| 96 |
+
url={[https://arxiv.org/abs/2511.21299](https://arxiv.org/abs/2511.21299)},
|
| 97 |
+
}
|