probablybots
commited on
Commit
•
c3b4f26
1
Parent(s):
c2ac139
Update README.md
Browse files
README.md
CHANGED
@@ -30,80 +30,70 @@ The pre-training data contains 42 million unique ncRNA sequences from RNAcentral
|
|
30 |
|
31 |
|
32 |
## How to Use
|
33 |
-
Build any downstream models from this backbone
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
###
|
|
|
36 |
```python
|
37 |
-
from
|
38 |
-
model = Embed.from_config({"model.backbone": "
|
39 |
-
collated_batch = model.collate({"sequences": ["ACGT", "
|
40 |
embedding = model(collated_batch)
|
41 |
print(embedding.shape)
|
42 |
print(embedding)
|
43 |
```
|
44 |
-
|
45 |
-
### Sequence-level regression
|
46 |
```python
|
47 |
-
|
48 |
-
|
|
|
49 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
50 |
logits = model(collated_batch)
|
51 |
print(logits)
|
|
|
52 |
```
|
53 |
-
|
54 |
-
### Sequence-level classification
|
55 |
```python
|
56 |
import torch
|
57 |
-
from
|
58 |
-
model =
|
59 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
60 |
logits = model(collated_batch)
|
61 |
print(logits)
|
62 |
print(torch.argmax(logits, dim=-1))
|
63 |
```
|
64 |
-
|
65 |
-
### Token-level classification
|
66 |
```python
|
67 |
-
import
|
68 |
-
|
69 |
-
model = TokenClassification.from_config({"model.backbone": "aido_rna_1b600m", "model.n_classes": 3}).eval()
|
70 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
71 |
logits = model(collated_batch)
|
72 |
print(logits)
|
73 |
-
print(torch.argmax(logits, dim=-1))
|
74 |
-
```
|
75 |
-
|
76 |
-
### Pairwise token-level classification
|
77 |
-
@Sazan TODO
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
```
|
89 |
|
90 |
-
For more information, visit: [ModelGenerator](https://github.com/genbio-ai/modelgenerator)
|
91 |
-
|
92 |
## Citation
|
93 |
Please cite AIDO.RNA using the following BibTeX code:
|
94 |
```
|
95 |
-
@
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
}
|
103 |
```
|
104 |
-
|
105 |
-
|
106 |
-
## License
|
107 |
-
@Hongyi TODO
|
108 |
-
|
109 |
-
|
|
|
30 |
|
31 |
|
32 |
## How to Use
|
33 |
+
### Build any downstream models from this backbone with ModelGenerator
|
34 |
+
For more information, visit: [Model Generator](https://github.com/genbio-ai/modelgenerator)
|
35 |
+
```bash
|
36 |
+
mgen fit --model SequenceClassification --model.backbone aido_rna_1b600m --data SequenceClassificationDataModule --data.path <hf_or_local_path_to_your_dataset>
|
37 |
+
mgen test --model SequenceClassification --model.backbone aido_rna_1b600m --data SequenceClassificationDataModule --data.path <hf_or_local_path_to_your_dataset>
|
38 |
+
```
|
39 |
|
40 |
+
### Or use directly in Python
|
41 |
+
#### Embedding
|
42 |
```python
|
43 |
+
from modelgenerator.tasks import Embed
|
44 |
+
model = Embed.from_config({"model.backbone": "aido_dna_7b"}).eval()
|
45 |
+
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
46 |
embedding = model(collated_batch)
|
47 |
print(embedding.shape)
|
48 |
print(embedding)
|
49 |
```
|
50 |
+
#### Sequence-level Classification
|
|
|
51 |
```python
|
52 |
+
import torch
|
53 |
+
from modelgenerator.tasks import SequenceClassification
|
54 |
+
model = SequenceClassification.from_config({"model.backbone": "aido_dna_7b", "model.n_classes": 2}).eval()
|
55 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
56 |
logits = model(collated_batch)
|
57 |
print(logits)
|
58 |
+
print(torch.argmax(logits, dim=-1))
|
59 |
```
|
60 |
+
#### Token-level Classification
|
|
|
61 |
```python
|
62 |
import torch
|
63 |
+
from modelgenerator.tasks import TokenClassification
|
64 |
+
model = TokenClassification.from_config({"model.backbone": "aido_dna_7b", "model.n_classes": 3}).eval()
|
65 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
66 |
logits = model(collated_batch)
|
67 |
print(logits)
|
68 |
print(torch.argmax(logits, dim=-1))
|
69 |
```
|
70 |
+
#### Sequence-level Regression
|
|
|
71 |
```python
|
72 |
+
from modelgenerator.tasks import SequenceRegression
|
73 |
+
model = SequenceRegression.from_config({"model.backbone": "aido_dna_7b"}).eval()
|
|
|
74 |
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
75 |
logits = model(collated_batch)
|
76 |
print(logits)
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
+
### Get RNA sequence embedding
|
79 |
+
```python
|
80 |
+
from genbio_finetune.tasks import Embed
|
81 |
+
model = Embed.from_config({"model.backbone": "aido_rna_1b600m"}).eval()
|
82 |
+
collated_batch = model.collate({"sequences": ["ACGT", "ACGT"]})
|
83 |
+
embedding = model(collated_batch)
|
84 |
+
print(embedding.shape)
|
85 |
+
print(embedding)
|
86 |
```
|
87 |
|
|
|
|
|
88 |
## Citation
|
89 |
Please cite AIDO.RNA using the following BibTeX code:
|
90 |
```
|
91 |
+
@misc{zou_large-scale_2024,
|
92 |
+
title = {A Large-Scale Foundation Model for RNA Function and Structure Prediction},
|
93 |
+
url = {https://www.biorxiv.org/content/10.1101/2024.11.28.625345v1},
|
94 |
+
doi = {10.1101/2024.11.28.625345},
|
95 |
+
publisher = {bioRxiv},
|
96 |
+
author = {Zou, Shuxian and Tao, Tianhua and Mahbub, Sazan and Ellington, Caleb N. and Algayres, Robin and Li, Dian and Zhuang, Yonghao and Wang, Hongyi and Song, Le and Xing, Eric P.},
|
97 |
+
year = {2024},
|
98 |
}
|
99 |
```
|
|
|
|
|
|
|
|
|
|
|
|