Text Generation
Transformers
PyTorch
gpt2
chemistry
molecule
drug
custom_code
text-generation-inference
Instructions to use entropy/roberta_zinc_decoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use entropy/roberta_zinc_decoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="entropy/roberta_zinc_decoder", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("entropy/roberta_zinc_decoder", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("entropy/roberta_zinc_decoder", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use entropy/roberta_zinc_decoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "entropy/roberta_zinc_decoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "entropy/roberta_zinc_decoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/entropy/roberta_zinc_decoder
- SGLang
How to use entropy/roberta_zinc_decoder 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 "entropy/roberta_zinc_decoder" \ --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": "entropy/roberta_zinc_decoder", "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 "entropy/roberta_zinc_decoder" \ --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": "entropy/roberta_zinc_decoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use entropy/roberta_zinc_decoder with Docker Model Runner:
docker model run hf.co/entropy/roberta_zinc_decoder
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,7 +8,8 @@ tags:
|
|
| 8 |
# Roberta Zinc Decoder
|
| 9 |
|
| 10 |
This model is a GPT2 decoder model designed to reconstruct SMILES strings from embeddings created by the
|
| 11 |
-
[roberta_zinc_480m](https://huggingface.co/entropy/roberta_zinc_480m) model.
|
|
|
|
| 12 |
|
| 13 |
The decoder model conditions generation on mean pooled embeddings from the encoder model. Mean pooled
|
| 14 |
embeddings are used to allow for integration with vector databases, which require fixed length embeddings.
|
|
@@ -62,6 +63,30 @@ gen = decoder_model.generate(
|
|
| 62 |
reconstructed_smiles = tokenizer.batch_decode(gen, skip_special_tokens=True)
|
| 63 |
```
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
---
|
| 66 |
license: mit
|
| 67 |
---
|
|
|
|
| 8 |
# Roberta Zinc Decoder
|
| 9 |
|
| 10 |
This model is a GPT2 decoder model designed to reconstruct SMILES strings from embeddings created by the
|
| 11 |
+
[roberta_zinc_480m](https://huggingface.co/entropy/roberta_zinc_480m) model. The decoder model was
|
| 12 |
+
trained on 30m compounds from the [ZINC Database](https://zinc.docking.org/).
|
| 13 |
|
| 14 |
The decoder model conditions generation on mean pooled embeddings from the encoder model. Mean pooled
|
| 15 |
embeddings are used to allow for integration with vector databases, which require fixed length embeddings.
|
|
|
|
| 63 |
reconstructed_smiles = tokenizer.batch_decode(gen, skip_special_tokens=True)
|
| 64 |
```
|
| 65 |
|
| 66 |
+
## Model Performance
|
| 67 |
+
|
| 68 |
+
The decoder model was evaluated on a test set of 1m compounds from ZINC. Compounds
|
| 69 |
+
were encoded with the [roberta_zinc_480m](https://huggingface.co/entropy/roberta_zinc_480m) model
|
| 70 |
+
and reconstructed with the decoder model.
|
| 71 |
+
|
| 72 |
+
The following metrics are computed:
|
| 73 |
+
* `exact_match` - percent of inputs exactly reconstructed
|
| 74 |
+
* `token_accuracy` - percent of output tokens exactly matching input tokens (excluding padding)
|
| 75 |
+
* `valid_structure` - percent of generated outputs that resolved to a valid SMILES string
|
| 76 |
+
* `tanimoto` - tanimoto similarity between inputs and generated outputs. Excludes invalid structures
|
| 77 |
+
* `cos_sim` - cosine similarity between input encoder embeddings and output encoder embeddings
|
| 78 |
+
|
| 79 |
+
`eval_type=full` reports metrics for the full 1m compound test set.
|
| 80 |
+
|
| 81 |
+
`eval_type=failed` subsets metrics for generated outputs that failed to exactly replicate the inputs.
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|eval_type|exact_match|token_accuracy|valid_structure|tanimoto|cos_sim |
|
| 85 |
+
|---------|-----------|--------------|---------------|--------|--------|
|
| 86 |
+
|full |0.948277 |0.990704 |0.994278 |0.987698|0.998224|
|
| 87 |
+
|failed |0.000000 |0.820293 |0.889372 |0.734097|0.965668|
|
| 88 |
+
|
| 89 |
+
|
| 90 |
---
|
| 91 |
license: mit
|
| 92 |
---
|