Instructions to use DeepChem/ChemBERTa-77M-MLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DeepChem/ChemBERTa-77M-MLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="DeepChem/ChemBERTa-77M-MLM")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("DeepChem/ChemBERTa-77M-MLM") model = AutoModelForMaskedLM.from_pretrained("DeepChem/ChemBERTa-77M-MLM", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Broken Tokenizer
Hi!
I think the tokenizer for this model and other models that use atom-wise tokenization is faulty. Here, I show one of the example.
Input: "CCCCCCCCCCCCCCCCCCP+([O-])O.CCCCCCCCCCCCCCCCCCP+([O-])[O-].[La+3]"
Expected Tokens (Length = 55): ['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', '[P+]', '(', '[O-]', ')', '(', '[O-]', ')', 'O', '.', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', '[P+]', '(', '[O-]', ')', '(', '[O-]', ')', '[O-]', '.', '[La+3]']
Observed Tokens (Length = 60): ['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'P', '(', 'O', '-', ')', '(', 'O', '-', ')', 'O', '.', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'P', '(', 'O', '-', ')', '(', 'O', '-', ')', 'O', '-', '.', '3']
It seems that the tokenizer no longer respect the square brackets and +/-. I believe that a different version of the library that may interpret the regex differently, since I saw this across different models.