DianLiI commited on
Commit
2197b40
1 Parent(s): aeaa9de

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## How to Use
2
+ ### Download model
3
+ ```python
4
+ from huggingface_hub import snapshot_download
5
+ from pathlib import Path
6
+
7
+ model_name = "genbio-ai/dnafm-7b-gue-splice-reconstruction-ckpt"
8
+ genbio_models_path = Path.home().joinpath('genbio_models', model_name)
9
+ genbio_models_path.mkdir(parents=True, exist_ok=True)
10
+ snapshot_download(repo_id=model_name, local_dir=genbio_models_path)
11
+ ```
12
+ ### Load model for inference
13
+ ```python
14
+ import torch
15
+ from genbio_finetune.tasks import SequenceClassification
16
+
17
+ ckpt_path = genbio_models_path.joinpath('model.ckpt')
18
+ model = SequenceClassification.load_from_checkpoint(ckpt_path, strict_loading=False).eval()
19
+
20
+ collated_batch = model.collate({"sequences": ["ACGT", "AGCT"]})
21
+ logits = model(collated_batch)
22
+ print(logits)
23
+ print(torch.argmax(logits, dim=-1))
24
+ ```