Update README.md
Browse files
README.md
CHANGED
|
@@ -12,10 +12,23 @@ This model is copied version of DNABERT-2 which removes the FlashAttention integ
|
|
| 12 |
```
|
| 13 |
import torch
|
| 14 |
from transformers import AutoTokenizer, AutoModel
|
|
|
|
|
|
|
| 15 |
device = torch.device("cuda")
|
| 16 |
|
| 17 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
dna = "ACGTAGCATCGGATCTATCTATCGACACTTGGTTATCGATCTACGAGCATCTCGTTAGC"
|
| 21 |
inputs = tokenizer(dna, return_tensors = 'pt')["input_ids"]
|
|
|
|
| 12 |
```
|
| 13 |
import torch
|
| 14 |
from transformers import AutoTokenizer, AutoModel
|
| 15 |
+
from transformers.models.bert.configuration_bert import BertConfig
|
| 16 |
+
|
| 17 |
device = torch.device("cuda")
|
| 18 |
|
| 19 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 20 |
+
"quietflamingo/dnabert2-fixed",
|
| 21 |
+
trust_remote_code=True,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
config = BertConfig.from_pretrained(
|
| 25 |
+
"quietflamingo/dnabert2-fixed",
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
self.model = AutoModel.from_pretrained(
|
| 29 |
+
"quietflamingo/dnabert2-fixed",
|
| 30 |
+
config=config
|
| 31 |
+
)
|
| 32 |
|
| 33 |
dna = "ACGTAGCATCGGATCTATCTATCGACACTTGGTTATCGATCTACGAGCATCTCGTTAGC"
|
| 34 |
inputs = tokenizer(dna, return_tensors = 'pt')["input_ids"]
|