File size: 1,919 Bytes
403475c
 
 
 
55e7080
 
 
96bce5f
 
176e474
55e7080
96bce5f
 
 
 
55e7080
96bce5f
 
 
176e474
55e7080
96bce5f
 
 
 
55e7080
96bce5f
 
 
176e474
55e7080
96bce5f
 
 
 
55e7080
96bce5f
 
176e474
55e7080
96bce5f
 
 
55e7080
96bce5f
176e474
 
96bce5f
55e7080
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## AIDO.DNA

For a more detailed description, refer to the SOTA model in this collection https://huggingface.co/genbio-ai/dnafm-7b

## How to Use
### Build any downstream models from this backbone
#### Embedding
```python
from genbio_finetune.tasks import Embed
model = Embed.from_config({"model.backbone": "dna300m"}).eval()
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
embedding = model(collated_batch)
print(embedding.shape)
print(embedding)
```
#### Sequence Level Classification
```python
import torch
from genbio_finetune.tasks import SequenceClassification
model = SequenceClassification.from_config({"model.backbone": "dna300m", "model.n_classes": 2}).eval()
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
logits = model(collated_batch)
print(logits)
print(torch.argmax(logits, dim=-1))
```
#### Token Level Classification
```python
import torch
from genbio_finetune.tasks import TokenClassification
model = TokenClassification.from_config({"model.backbone": "dna300m", "model.n_classes": 3}).eval()
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
logits = model(collated_batch)
print(logits)
print(torch.argmax(logits, dim=-1))
```
#### Regression
```python
from genbio_finetune.tasks import SequenceRegression
model = SequenceRegression.from_config({"model.backbone": "dna300m"}).eval()
collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
logits = model(collated_batch)
print(logits)
```
#### Or use our one-liner CLI to finetune or evaluate any of the above!
```
gbft fit --model SequenceClassification --model.backbone dna300m --data SequenceClassification --data.path <hf_or_local_path_to_your_dataset>
gbft test --model SequenceClassification --model.backbone dna300m --data SequenceClassification --data.path <hf_or_local_path_to_your_dataset>
```
For more information, visit: [Model Generator](https://github.com/genbio-ai/modelgenerator)