Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- pretrained
|
| 5 |
+
- mistral
|
| 6 |
+
- DNA
|
| 7 |
+
- non coding
|
| 8 |
+
- rfam
|
| 9 |
+
- biology
|
| 10 |
+
- genomics
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Model Card for Mistral-DNA-v1-138M-noncoding (mistral for DNA)
|
| 14 |
+
|
| 15 |
+
The Mistral-DNA-v1-138M-noncoding Large Language Model (LLM) is a pretrained generative DNA text model with 17.31M parameters x 8 experts = 138.5M parameters.
|
| 16 |
+
It is derived from Mistral-7B-v0.1 model, which was simplified for DNA: the number of layers and the hidden size were reduced.
|
| 17 |
+
The model was pretrained using around 1940736 non coding RNAs > 100b from rfam database. Sequences were split into 100b sequences.
|
| 18 |
+
|
| 19 |
+
NB: the DNA sequence was used, not the RNA sequence.
|
| 20 |
+
|
| 21 |
+
For full details of this model please read our [github repo](https://github.com/raphaelmourad/Mistral-DNA).
|
| 22 |
+
|
| 23 |
+
## Model Architecture
|
| 24 |
+
|
| 25 |
+
Like Mistral-7B-v0.1, it is a transformer model, with the following architecture choices:
|
| 26 |
+
- Grouped-Query Attention
|
| 27 |
+
- Sliding-Window Attention
|
| 28 |
+
- Byte-fallback BPE tokenizer
|
| 29 |
+
|
| 30 |
+
## Load the model from huggingface:
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
import torch
|
| 34 |
+
from transformers import AutoTokenizer, AutoModel
|
| 35 |
+
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained("RaphaelMourad/Mistral-DNA-v1-138M-noncoding", trust_remote_code=True) # Same as DNABERT2
|
| 37 |
+
model = AutoModel.from_pretrained("RaphaelMourad/Mistral-DNA-v1-138M-noncoding", trust_remote_code=True)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Calculate the embedding of a DNA sequence
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
dna = "TGATGATTGGCGCGGCTAGGATCGGCT"
|
| 44 |
+
inputs = tokenizer(dna, return_tensors = 'pt')["input_ids"]
|
| 45 |
+
hidden_states = model(inputs)[0] # [1, sequence_length, 256]
|
| 46 |
+
|
| 47 |
+
# embedding with max pooling
|
| 48 |
+
embedding_max = torch.max(hidden_states[0], dim=0)[0]
|
| 49 |
+
print(embedding_max.shape) # expect to be 256
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Troubleshooting
|
| 53 |
+
|
| 54 |
+
Ensure you are utilizing a stable version of Transformers, 4.34.0 or newer.
|
| 55 |
+
|
| 56 |
+
## Notice
|
| 57 |
+
|
| 58 |
+
Mistral-DNA-v1-138M-noncoding is a pretrained base model for non coding RNAs.
|
| 59 |
+
|
| 60 |
+
## Contact
|
| 61 |
+
|
| 62 |
+
Raphaël Mourad. [email protected]
|
| 63 |
+
|