Files changed (1) hide show
  1. README.md +9 -1
README.md CHANGED
@@ -14,7 +14,7 @@ We sincerely appreciate the MosaicML team for the [MosaicBERT](https://openrevie
14
 
15
  DNABERT-2 is a transformer-based genome foundation model trained on multi-species genome.
16
 
17
- To load the model from huggingface:
18
  ```
19
  import torch
20
  from transformers import AutoTokenizer, AutoModel
@@ -22,6 +22,14 @@ from transformers import AutoTokenizer, AutoModel
22
  tokenizer = AutoTokenizer.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
23
  model = AutoModel.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
24
  ```
 
 
 
 
 
 
 
 
25
 
26
  To calculate the embedding of a dna sequence
27
  ```
 
14
 
15
  DNABERT-2 is a transformer-based genome foundation model trained on multi-species genome.
16
 
17
+ To load the model from huggingface(version 4.28):
18
  ```
19
  import torch
20
  from transformers import AutoTokenizer, AutoModel
 
22
  tokenizer = AutoTokenizer.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
23
  model = AutoModel.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True)
24
  ```
25
+ To load the model from huggingface (version > 4.28):
26
+ ```
27
+ from transformers.models.bert.configuration_bert import BertConfig
28
+ from transformers import AutoModel
29
+
30
+ config = BertConfig.from_pretrained("zhihan1996/DNABERT-2-117M")
31
+ model = AutoModel.from_pretrained("zhihan1996/DNABERT-2-117M", trust_remote_code=True, config=config)
32
+ ```
33
 
34
  To calculate the embedding of a dna sequence
35
  ```