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
- bert_layers.py +2 -0
bert_layers.py
CHANGED
|
@@ -23,6 +23,7 @@ from transformers.models.bert.modeling_bert import BertPreTrainedModel
|
|
| 23 |
from .bert_padding import (index_first_axis,
|
| 24 |
index_put_first_axis, pad_input,
|
| 25 |
unpad_input, unpad_input_only)
|
|
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
from .flash_attn_triton import flash_attn_qkvpacked_func
|
|
@@ -563,6 +564,7 @@ class BertModel(BertPreTrainedModel):
|
|
| 563 |
all_encoder_layers, pooled_output = model(input_ids, token_type_ids, input_mask)
|
| 564 |
```
|
| 565 |
"""
|
|
|
|
| 566 |
|
| 567 |
def __init__(self, config, add_pooling_layer=True):
|
| 568 |
super(BertModel, self).__init__(config)
|
|
|
|
| 23 |
from .bert_padding import (index_first_axis,
|
| 24 |
index_put_first_axis, pad_input,
|
| 25 |
unpad_input, unpad_input_only)
|
| 26 |
+
from .configuration_bert import BertConfig
|
| 27 |
|
| 28 |
try:
|
| 29 |
from .flash_attn_triton import flash_attn_qkvpacked_func
|
|
|
|
| 564 |
all_encoder_layers, pooled_output = model(input_ids, token_type_ids, input_mask)
|
| 565 |
```
|
| 566 |
"""
|
| 567 |
+
config_class = BertConfig
|
| 568 |
|
| 569 |
def __init__(self, config, add_pooling_layer=True):
|
| 570 |
super(BertModel, self).__init__(config)
|