Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- pretrained
|
| 5 |
+
- modernbert
|
| 6 |
+
- protein
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Model Card for ModernBert-Prot-v1-34M (ModernBert for protein)
|
| 10 |
+
|
| 11 |
+
The ModernBert-Prot-v1-34M Large Language Model (LLM) is a pretrained generative DNA sequence model with 37M parameters.
|
| 12 |
+
It is derived from ModernBERT model, which was simplified for DNA: the number of layers and the hidden size were reduced.
|
| 13 |
+
The model was pretrained using 10M protein strings from the uniprot 50 database.
|
| 14 |
+
|
| 15 |
+
## Load the model from huggingface:
|
| 16 |
+
|
| 17 |
+
```
|
| 18 |
+
import torch
|
| 19 |
+
from transformers import AutoTokenizer, AutoModel
|
| 20 |
+
|
| 21 |
+
tokenizer = AutoTokenizer.from_pretrained("RaphaelMourad/ModernBert-Prot-v1-34M", trust_remote_code=True)
|
| 22 |
+
model = AutoModel.from_pretrained("RaphaelMourad/ModernBert-Prot-v1-34M", trust_remote_code=True)
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Calculate the embedding of a DNA sequence
|
| 26 |
+
|
| 27 |
+
```
|
| 28 |
+
insulin = "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"
|
| 29 |
+
inputs = tokenizer(insulin, return_tensors = 'pt')["input_ids"]
|
| 30 |
+
hidden_states = model(inputs)[0] # [1, sequence_length, 256]
|
| 31 |
+
|
| 32 |
+
# embedding with max pooling
|
| 33 |
+
embedding_max = torch.max(hidden_states[0], dim=0)[0]
|
| 34 |
+
print(embedding_max.shape) # expect to be 256
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Troubleshooting
|
| 38 |
+
|
| 39 |
+
Ensure you are utilizing a stable version of Transformers, 4.34.0 or newer.
|
| 40 |
+
|
| 41 |
+
## Notice
|
| 42 |
+
|
| 43 |
+
ModernBert-Prot-v1-34M is a pretrained base model for DNA.
|
| 44 |
+
|
| 45 |
+
## Contact
|
| 46 |
+
|
| 47 |
+
Raphaël Mourad. raphael.mourad@univ-tlse3.fr
|