Instructions to use knowledgator/IUPAC2SMILES-canonical-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use knowledgator/IUPAC2SMILES-canonical-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="knowledgator/IUPAC2SMILES-canonical-base")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("knowledgator/IUPAC2SMILES-canonical-base") model = AutoModelForSeq2SeqLM.from_pretrained("knowledgator/IUPAC2SMILES-canonical-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use knowledgator/IUPAC2SMILES-canonical-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "knowledgator/IUPAC2SMILES-canonical-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "knowledgator/IUPAC2SMILES-canonical-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/knowledgator/IUPAC2SMILES-canonical-base
- SGLang
How to use knowledgator/IUPAC2SMILES-canonical-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 "knowledgator/IUPAC2SMILES-canonical-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": "knowledgator/IUPAC2SMILES-canonical-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 "knowledgator/IUPAC2SMILES-canonical-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": "knowledgator/IUPAC2SMILES-canonical-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use knowledgator/IUPAC2SMILES-canonical-base with Docker Model Runner:
docker model run hf.co/knowledgator/IUPAC2SMILES-canonical-base
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
IUPAC2SMILES-canonical-base
IUPAC2SMILES-canonical-base was designed to accurately translate IUPAC chemical names to SMILES.
Model Details
Model Description
IUPAC2SMILES-canonical-base is based on the MT5 model with optimizations in implementing different tokenizers for the encoder and decoder.
- Developed by: Knowladgator Engineering
- Model type: Encoder-Decoder with attention mechanism
- Language(s) (NLP): SMILES, IUPAC (English)
- License: Apache License 2.0
Model Sources
- Paper: coming soon
- Demo: ChemicalConverters
Quickstart
Firstly, install the library:
pip install chemical-converters
IUPAC to SMILES
To perform simple translation, follow the example:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/IUPAC2SMILES-canonical-base")
print(converter.iupac_to_smiles('ethanol'))
print(converter.iupac_to_smiles(['ethanol', 'ethanol', 'ethanol']))
['CCO']
['CCO', 'CCO', 'CCO']
Processing in batches:
from chemicalconverters import NamesConverter
converter = NamesConverter(model_name="knowledgator/IUPAC2SMILES-canonical-base")
print(converter.iupac_to_smiles(["buta-1,3-diene" for _ in range(10)], num_beams=1,
process_in_batch=True, batch_size=1000))
['<SYST>C=CC=C', '<SYST>C=CC=C'...]
Our models also predict IUPAC styles from the table:
| Style Token | Description |
|---|---|
<BASE> |
The most known name of the substance, sometimes is the mixture of traditional and systematic style |
<SYST> |
The totally systematic style without trivial names |
<TRAD> |
The style is based on trivial names of the parts of substances |
Bias, Risks, and Limitations
This model has limited accuracy in processing large molecules and currently, doesn't support isomeric and isotopic SMILES.
Training Procedure
The model was trained on 100M examples of SMILES-IUPAC pairs with lr=0.00001, batch_size=512 for 2 epochs.
Evaluation
| Model | Accuracy | BLEU-4 score | Size(MB) |
|---|---|---|---|
| IUPAC2SMILES-canonical-small | 88.9% | 0.966 | 23 |
| IUPAC2SMILES-canonical-base | 93.7% | 0.974 | 180 |
| STOUT V2.0* | 68.47% | 0.92 | 128 |
| *According to the original paper https://jcheminf.biomedcentral.com/articles/10.1186/s13321-021-00512-4 |
Citation
Coming soon.
Model Card Authors
Model Card Contact
- Downloads last month
- 1,559