Instructions to use yerevann/chemlactica-125m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yerevann/chemlactica-125m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yerevann/chemlactica-125m")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yerevann/chemlactica-125m") model = AutoModelForCausalLM.from_pretrained("yerevann/chemlactica-125m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yerevann/chemlactica-125m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yerevann/chemlactica-125m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yerevann/chemlactica-125m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yerevann/chemlactica-125m
- SGLang
How to use yerevann/chemlactica-125m 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 "yerevann/chemlactica-125m" \ --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": "yerevann/chemlactica-125m", "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 "yerevann/chemlactica-125m" \ --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": "yerevann/chemlactica-125m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yerevann/chemlactica-125m with Docker Model Runner:
docker model run hf.co/yerevann/chemlactica-125m
Chemlactica-125M
Chemlactica-125M is a 125M-parameter causal language model for molecular generation, property conditioning, property prediction, and optimization. It continues pretraining from Galactica-125M on PubChemForLM: 40 billion tokens describing more than 110 million PubChem molecules, computed properties, and molecular similarities.
Model details
- Architecture:
OPTForCausalLM; 12 layers, hidden size 768, 12 attention heads - Context length: 2,048 tokens
- Training objective: causal language modeling
- Training-data cutoff: January 26, 2023
- Molecular preprocessing: RDKit-canonicalized SMILES; numeric properties rounded to two decimals
Prompt format
Chemlactica prompts begin with </s>. Generate a molecule by ending a structured property prefix with [START_SMILES]:
</s>[SAS]2.25[/SAS][SIMILAR]CC(=O)OC1=CC=CC=C1C(=O)O 0.62[/SIMILAR][START_SMILES]
The similarity field is reference SMILES, a space, then the target ECFP Tanimoto similarity. To predict a property, provide the molecule and open the desired property tag:
</s>[START_SMILES]CC(=O)OC1=CC=CC=C1C(=O)O[END_SMILES][SAS]
Common trained tags include [SAS], [QED], [WEIGHT], [TPSA], [CLOGP], [FORMULA], [RINGCOUNT], and [SIMILAR]. Use only tags present in the training format; arbitrary natural-language instructions or oracle names are unsupported.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "yerevann/chemlactica-125m"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, device_map="auto", torch_dtype="auto"
)
prompt = "</s>[QED]0.80[/QED][START_SMILES]"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs, max_new_tokens=128, do_sample=True, temperature=0.8, top_p=0.95
)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
For optimization, use the Mol-E implementation and canonical PMO prompt registry. In the five-seed PMO-10K reproduction, this checkpoint obtains summed Top-10 AUC scores of 16.944598 (task-agnostic) and 20.429421 (task-informed) across 23 tasks.
Intended use and limitations
This checkpoint is intended for research on small-molecule language modeling and optimization. Generated strings may be invalid, duplicated, chemically implausible, difficult to synthesize, unsafe, or outside the requested property range. Reported properties are predictions or optimization-oracle outputs, not experimental measurements. PubChem-derived data may contain errors or biases, and the model has no knowledge of changes after the cutoff date. Do not use it for clinical decisions or as a substitute for experimental and expert review.
Resources and license
- Paper: Small Molecule Optimization with Large Language Models
- Code: YerevaNN/ChemLactica
- Data: yerevann/PubChemForLM
- Family: Chemlactica-1.3B, Chemma-2B
The checkpoint is released under CC BY-NC 4.0. Users must also comply with applicable terms of the base model and source data.
- Downloads last month
- 540
Model tree for yerevann/chemlactica-125m
Base model
facebook/galactica-125m