Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- pretrained
|
| 5 |
+
- mistral
|
| 6 |
+
- DNA
|
| 7 |
+
- codon
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Model Card for Mistral-Codon-v1-1M (Mistral for coding DNA)
|
| 11 |
+
|
| 12 |
+
The Mistral-Codon-v1-1M Large Language Model (LLM) is a pretrained generative DNA sequence model with 1M parameters.
|
| 13 |
+
It is derived from Mixtral-8x7B-v0.1 model, which was simplified for DNA: the number of layers and the hidden size were reduced.
|
| 14 |
+
The model was pretrained using 24M coding DNA sequences (3000bp) from many different species (vertebrates, plants, bacteria, viruses, ...).
|
| 15 |
+
|
| 16 |
+
## Model Architecture
|
| 17 |
+
|
| 18 |
+
Like Mixtral-8x7B-v0.1, it is a transformer model, with the following architecture choices:
|
| 19 |
+
- Grouped-Query Attention
|
| 20 |
+
- Sliding-Window Attention
|
| 21 |
+
- Byte-fallback BPE tokenizer
|
| 22 |
+
- Mixture of Experts
|
| 23 |
+
|
| 24 |
+
## Load the model from huggingface:
|
| 25 |
+
|
| 26 |
+
```
|
| 27 |
+
import torch
|
| 28 |
+
from transformers import AutoTokenizer, AutoModel
|
| 29 |
+
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained("RaphaelMourad/Mistral-Codon-v1-1M", trust_remote_code=True)
|
| 31 |
+
model = AutoModel.from_pretrained("RaphaelMourad/Mistral-Codon-v1-1M", trust_remote_code=True)
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Calculate the embedding of a coding sequence
|
| 35 |
+
|
| 36 |
+
```
|
| 37 |
+
codon_dna = "TGA TGA TTG GCG CGG CTA GGA TCG GCT"
|
| 38 |
+
inputs = tokenizer(codon_dna, return_tensors = 'pt')["input_ids"]
|
| 39 |
+
hidden_states = model(inputs)[0] # [1, sequence_length, 256]
|
| 40 |
+
|
| 41 |
+
# embedding with max pooling
|
| 42 |
+
embedding_max = torch.max(hidden_states[0], dim=0)[0]
|
| 43 |
+
print(embedding_max.shape) # expect to be 256
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Troubleshooting
|
| 47 |
+
|
| 48 |
+
Ensure you are utilizing a stable version of Transformers, 4.34.0 or newer.
|
| 49 |
+
|
| 50 |
+
## Notice
|
| 51 |
+
|
| 52 |
+
Mistral-Codon-v1-1M is a pretrained base model for coding DNA.
|
| 53 |
+
|
| 54 |
+
## Contact
|
| 55 |
+
|
| 56 |
+
Raphaël Mourad. raphael.mourad@univ-tlse3.fr
|