Instructions to use ddidacus/smolgen-pubchem-46M-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ddidacus/smolgen-pubchem-46M-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ddidacus/smolgen-pubchem-46M-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ddidacus/smolgen-pubchem-46M-base") model = AutoModelForCausalLM.from_pretrained("ddidacus/smolgen-pubchem-46M-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ddidacus/smolgen-pubchem-46M-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ddidacus/smolgen-pubchem-46M-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ddidacus/smolgen-pubchem-46M-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ddidacus/smolgen-pubchem-46M-base
- SGLang
How to use ddidacus/smolgen-pubchem-46M-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 "ddidacus/smolgen-pubchem-46M-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": "ddidacus/smolgen-pubchem-46M-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 "ddidacus/smolgen-pubchem-46M-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": "ddidacus/smolgen-pubchem-46M-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ddidacus/smolgen-pubchem-46M-base with Docker Model Runner:
docker model run hf.co/ddidacus/smolgen-pubchem-46M-base
smolgen-pubchem-46M-base
A 46M-parameter causal language model for de novo molecule generation trained on SMILES strings from PubChem.
Training Data
The model was pretrained on ~40 million molecules sourced from PubChem and filtered by:
- Heavy atom count: only drug-like size molecules retained
- Structure alerts: compounds flagged by common medicinal chemistry filters removed
- Salt removal: only the largest fragment of each compound kept
Model Architecture
Decoder-only Transformer (LlamaForCausalLM) with grouped-query attention (GQA):
| Parameter | Value |
|---|---|
| Hidden size | 576 |
| Intermediate size | 1536 |
| Layers | 13 |
| Attention heads | 9 (3 KV heads) |
| Max sequence length | 8192 |
| Vocabulary size | 36 |
Tokenizer
This model uses the REINVENT4 tokenizer — a chemistry-aware tokenizer that splits SMILES strings based on a hand-crafted regex covering atoms, bonds, ring closures, branches, and bracket atoms. The vocabulary has 36 tokens.
Usage
Pass an empty string to prompt the model to generate novel SMILES from scratch:
from transformers import AutoModelForCausalLM, PreTrainedTokenizerFast
model = AutoModelForCausalLM.from_pretrained("ddidacus/smolgen-pubchem-46M-base")
tokenizer = PreTrainedTokenizerFast.from_pretrained("ddidacus/smolgen-pubchem-46M-base")
inputs = tokenizer("", return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=128,
do_sample=True,
temperature=1.0,
num_return_sequences=10,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
)
smiles_list = tokenizer.batch_decode(outputs, skip_special_tokens=True)
print(smiles_list)
- Downloads last month
- 14