Update README.md
Browse files
README.md
CHANGED
|
@@ -2,11 +2,45 @@
|
|
| 2 |
license: mit
|
| 3 |
tags:
|
| 4 |
- biology
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
tags:
|
| 4 |
- biology
|
| 5 |
+
- genomics
|
| 6 |
+
- long-context
|
| 7 |
+
library_name: transformers
|
| 8 |
---
|
| 9 |
+
# DNAFlash
|
| 10 |
|
| 11 |
+
## Abouts
|
| 12 |
|
| 13 |
|
| 14 |
+
## How to use
|
| 15 |
+
### Simple example: embedding
|
| 16 |
|
| 17 |
+
```python
|
| 18 |
|
| 19 |
+
import torch
|
| 20 |
+
from transformers import AutoTokenizer, AutoModel
|
| 21 |
|
| 22 |
+
# Load the tokenizer and model using the pretrained model name
|
| 23 |
+
tokenizer = AutoTokenizer.from_pretrained("isyslab/DNAFlash")
|
| 24 |
+
model = AutoModel.from_pretrained("isyslab/DNAFlash", trust_remote_code=True)
|
| 25 |
|
| 26 |
+
|
| 27 |
+
# Define input sequences
|
| 28 |
+
sequences = [
|
| 29 |
+
"GAATTCCATGAGGCTATAGAATAATCTAAGAGAAATATATATATATTGAAAAAAAAAAAAAAAAAAAAAAAGGGG"
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
# Tokenize the sequences
|
| 33 |
+
inputs = tokenizer(
|
| 34 |
+
sequences,
|
| 35 |
+
add_special_tokens=True,
|
| 36 |
+
return_tensors="pt",
|
| 37 |
+
padding=True,
|
| 38 |
+
truncation=True
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
# Perform a forward pass through the model to obtain the outputs, including hidden states
|
| 42 |
+
with torch.inference_mode():
|
| 43 |
+
outputs = model(**inputs, output_hidden_states=True)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Citation
|