Instructions to use zhihan1996/DNA_bert_5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zhihan1996/DNA_bert_5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="zhihan1996/DNA_bert_5", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("zhihan1996/DNA_bert_5", trust_remote_code=True) model = AutoModelForMaskedLM.from_pretrained("zhihan1996/DNA_bert_5", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
| # Copyright 2022 MosaicML Examples authors | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from transformers import BertConfig as TransformersBertConfig | |
| class BertConfig(TransformersBertConfig): | |
| def __init__( | |
| self, | |
| **kwargs, | |
| ): | |
| """Configuration class for MosaicBert. | |
| Args: | |
| alibi_starting_size (int): Use `alibi_starting_size` to determine how large of an alibi tensor to | |
| create when initializing the model. You should be able to ignore this parameter in most cases. | |
| Defaults to 512. | |
| attention_probs_dropout_prob (float): By default, turn off attention dropout in Mosaic BERT | |
| (otherwise, Flash Attention will be off by default). Defaults to 0.0. | |
| """ | |
| super().__init__(**kwargs) | |