Instructions to use zhihan1996/DNABERT-S with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zhihan1996/DNABERT-S with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="zhihan1996/DNABERT-S", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("zhihan1996/DNABERT-S", trust_remote_code=True) model = AutoModel.from_pretrained("zhihan1996/DNABERT-S", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix error loading model with AutoModel
#1
by guyaglionby - opened
Fixes the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "snip/.venv/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 558, in from_pretrained
cls.register(config.__class__, model_class, exist_ok=True)
File "snip/.venv/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 584, in register
raise ValueError(
ValueError: The model class you are passing has a `config_class` attribute that is not consistent with the config class you passed (model has <class 'transformers.models.bert.configuration_bert.BertConfig'> and you passed <class 'transformers_modules.zhihan1996.DNABERT-S.1cdf84d992ace6f3e75c7356774b4da088c8dc7c.configuration_bert.BertConfig'>. Fix one of those so they match!
zhihan1996 changed pull request status to merged
Thanks for the updates! Merged.