Update README.md
Browse files
README.md
CHANGED
@@ -34,18 +34,54 @@ Here we briefly introduce the details of pre-training of ADIO.Protein 16B. For m
|
|
34 |
# Results
|
35 |
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
# Sequence Level Regression
|
49 |
|
50 |
# Or use our one-liner CLI to finetune or evaluate any of the above
|
51 |
|
|
|
34 |
# Results
|
35 |
|
36 |
|
37 |
+
## How to Use
|
38 |
+
### Build any downstream models from this backbone
|
39 |
+
#### Embedding
|
40 |
+
```python
|
41 |
+
from genbio_finetune.tasks import Embed
|
42 |
+
model = Embed.from_config({"model.backbone": "proteinfm"}).eval()
|
43 |
+
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
44 |
+
embedding = model(collated_batch)
|
45 |
+
print(embedding.shape)
|
46 |
+
print(embedding)
|
47 |
+
```
|
48 |
+
#### Sequence Level Classification
|
49 |
+
```python
|
50 |
+
import torch
|
51 |
+
from genbio_finetune.tasks import SequenceClassification
|
52 |
+
model = SequenceClassification.from_config({"model.backbone": "proteinfm", "model.n_classes": 2}).eval()
|
53 |
+
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
54 |
+
logits = model(collated_batch)
|
55 |
+
print(logits)
|
56 |
+
print(torch.argmax(logits, dim=-1))
|
57 |
+
```
|
58 |
+
#### Token Level Classification
|
59 |
+
```python
|
60 |
+
import torch
|
61 |
+
from genbio_finetune.tasks import TokenClassification
|
62 |
+
model = TokenClassification.from_config({"model.backbone": "proteinfm", "model.n_classes": 3}).eval()
|
63 |
+
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
64 |
+
logits = model(collated_batch)
|
65 |
+
print(logits)
|
66 |
+
print(torch.argmax(logits, dim=-1))
|
67 |
+
```
|
68 |
+
#### Regression
|
69 |
+
```python
|
70 |
+
from genbio_finetune.tasks import SequenceRegression
|
71 |
+
model = SequenceRegression.from_config({"model.backbone": "proteinfm"}).eval()
|
72 |
+
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
|
73 |
+
logits = model(collated_batch)
|
74 |
+
print(logits)
|
75 |
+
```
|
76 |
+
#### Protein-Protein Interaction
|
77 |
|
78 |
+
#### Or use our one-liner CLI to finetune or evaluate any of the above!
|
79 |
+
```
|
80 |
+
gbft fit --model SequenceClassification --model.backbone proteinfm --data SequenceClassification --data.path <hf_or_local_path_to_your_dataset>
|
81 |
+
gbft test --model SequenceClassification --model.backbone proteinfm --data SequenceClassification --data.path <hf_or_local_path_to_your_dataset>
|
82 |
+
```
|
83 |
+
For more information, visit: [Model Generator](https://github.com/genbio-ai/modelgenerator)
|
84 |
|
|
|
85 |
|
86 |
# Or use our one-liner CLI to finetune or evaluate any of the above
|
87 |
|