Instructions to use yerevann/chemma-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yerevann/chemma-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yerevann/chemma-2b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yerevann/chemma-2b") model = AutoModelForCausalLM.from_pretrained("yerevann/chemma-2b") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use yerevann/chemma-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yerevann/chemma-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yerevann/chemma-2b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yerevann/chemma-2b
- SGLang
How to use yerevann/chemma-2b 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/chemma-2b" \ --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/chemma-2b", "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/chemma-2b" \ --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/chemma-2b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yerevann/chemma-2b with Docker Model Runner:
docker model run hf.co/yerevann/chemma-2b
Chemma-2B is a continually pretrained gemma-2b model for organic molecules. It is pretrained on 40B tokens covering 110M+ molecules from PubChem as well as their chemical properties (molecular weight, synthetic accessibility score, drug-likeness etc.) and similarities (Tanimoto distance between ECFP fingerprints).
Example prompts:
</s>[START_SMILES]CC(=O)OC1=CC=CC=C1C(=O)O[END_SMILES][SAS] will attempt to predict the synthetic accessibility score of the given molecule.
</s>[SAS]2.25[/SAS][SIMILAR]0.62 CC(=O)OC1=CC=CC=C1C(=O)O[/SIMILAR][START_SMILES] will attempt to generate a molecule that has 2.25 SAS score and
has a 0.62 similarity score to the given molecule.
The model can be wrapped into an optimization loop to traverse the chemical space with evolving prompts. See the code on GitHub.
A preprint with the details of the model and an optimization algorithm built on top of this model that sets state-of-the-art on Practical Molecular Optimization and other benchmarks is available on arxiv.
Few notes:
- All queries should start with
</s>symbol. - All numbers are rounded to two decimal points.
- All SMILES are canonicalized using
rdkit. - Available tags:
[CLOGP],[WEIGHT],[QED],[SAS],[TPSA],[RINGCOUNT],[SIMILAR]...
The model is part of the 3-model family: Chemlactica-125M, Chemlactica-1.3B and Chemma-2B.
We are looking forward to see the community using the model in new applications and contexts.
- Downloads last month
- 1,305