Downloads · 30 days
60
3% of all-time downloads
NisargRhino/SmileBERTa
SmileBERTa is a fill-mask model from NisargRhino. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as mit.
SmileBERTa is a RoBERTa-based language model for chemistry, built on the ChemBERTa architecture and fine-tuned to predict small-molecule fragment SMILES from full small-molecule drug SMILES.
Downloads · 30 days
60
3% of all-time downloads
All-time downloads
2.2K
Public
Parameters
44.1M
176 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors176 MB · 100%
From the Hugging Face model README
SmileBERTa is a RoBERTa-based language model for chemistry, built on the ChemBERTa architecture and fine-tuned to predict small-molecule fragment SMILES from full small-molecule drug SMILES.
Fragment prediction is a common first step in fragment-based drug design, scaffold analysis, and retrosynthetic planning. SmileBERTa treats SMILES strings as a language, so it can also serve as a general-purpose chemical encoder for downstream tasks such as property prediction, similarity search, or molecular clustering.
Direct use
Downstream use
Out of scope
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("NisargRhino/SmileBERTa")
model = AutoModel.from_pretrained("NisargRhino/SmileBERTa")
smiles = "CC(=O)OC1=CC=CC=C1C(=O)O" # aspirin
inputs = tokenizer(smiles, return_tensors="pt")
outputs = model(**inputs)
# Pooled representation of the molecule
embedding = outputs.last_hidden_state.mean(dim=1)
print(embedding.shape)
Run generated SMILES through a validity check before use:
from rdkit import Chem
mol = Chem.MolFromSmiles(predicted_smiles)
if mol is None:
print("Invalid SMILES — discard or regenerate")
TODO — report metrics such as SMILES validity rate, Tanimoto similarity to ground-truth fragments, or exact-match accuracy on a held-out set.
Questions, feedback, and collaboration are welcome: [email protected]
@misc{smileberta,
author = {Nisarg S.},
title = {SmileBERTa: A ChemBERTa-based model for fragment SMILES prediction},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/NisargRhino/SmileBERTa}}
}