Instructions to use Taykhoom/DNABERT2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Taykhoom/DNABERT2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="Taykhoom/DNABERT2", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("Taykhoom/DNABERT2", trust_remote_code=True) model = AutoModelForMaskedLM.from_pretrained("Taykhoom/DNABERT2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_bert.py from Taykhoom/DNABERT2: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/Taykhoom/DNABERT2/resolve/main/configuration_bert.py
- Command line
-
hf download hf://Taykhoom/DNABERT2/configuration_bert.py
-
curl -L -o configuration_bert.py https://huggingface.co/Taykhoom/DNABERT2/resolve/main/configuration_bert.py
801 Bytes
| # Copyright 2022 MosaicML Examples authors | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from transformers import BertConfig as TransformersBertConfig | |
| class BertConfig(TransformersBertConfig): | |
| auto_map = { | |
| "AutoConfig": "configuration_bert.BertConfig", | |
| "AutoModel": "bert_layers.BertModel", | |
| "AutoModelForMaskedLM": "bert_layers.BertForMaskedLM", | |
| "AutoModelForSequenceClassification": "bert_layers.BertForSequenceClassification", | |
| } | |
| def __init__( | |
| self, | |
| alibi_starting_size: int = 1024, | |
| attention_probs_dropout_prob: float = 0.0, | |
| **kwargs, | |
| ): | |
| super().__init__( | |
| attention_probs_dropout_prob=attention_probs_dropout_prob, | |
| **kwargs, | |
| ) | |
| self.alibi_starting_size = alibi_starting_size | |