Text Classification
Transformers
PyTorch
genomics
virology
dna
virus
transmissibility
r0
hvue-v2
custom_code
Instructions to use duttaprat/HViLM-R0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use duttaprat/HViLM-R0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="duttaprat/HViLM-R0", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("duttaprat/HViLM-R0", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model: duttaprat/HViLM-base
|
| 4 |
+
datasets:
|
| 5 |
+
- duttaprat/HVUE-v2
|
| 6 |
+
pipeline_tag: text-classification
|
| 7 |
+
tags:
|
| 8 |
+
- genomics
|
| 9 |
+
- virology
|
| 10 |
+
- dna
|
| 11 |
+
- virus
|
| 12 |
+
- transmissibility
|
| 13 |
+
- r0
|
| 14 |
+
- hvue-v2
|
| 15 |
+
license: apache-2.0
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# HViLM-R0
|
| 19 |
+
|
| 20 |
+
**HViLM-R0** is the official HViLM model for binary virus transmissibility classification using the threshold R₀ < 1 versus R₀ ≥ 1.
|
| 21 |
+
|
| 22 |
+
- **Fine-tuned from:** [duttaprat/HViLM-base](https://huggingface.co/duttaprat/HViLM-base)
|
| 23 |
+
- **Benchmark:** [duttaprat/HVUE-v2](https://huggingface.co/datasets/duttaprat/HVUE-v2)
|
| 24 |
+
- **HVUE v2 configuration:** `Transmissibility/standard_capped_1000bp`
|
| 25 |
+
- **Checkpoint selection:** best validation F1 (`checkpoint-21000`)
|
| 26 |
+
- **Input:** virus nucleotide sequence
|
| 27 |
+
- **Output:** R₀ < 1 vs. R₀ ≥ 1 class
|
| 28 |
+
|
| 29 |
+
This repository contains a **standalone full fine-tuned checkpoint**, so users can load `duttaprat/HViLM-R0` directly without separately loading `HViLM-base`.
|
| 30 |
+
|
| 31 |
+
## Label Mapping
|
| 32 |
+
|
| 33 |
+
| ID | Label |
|
| 34 |
+
|---:|---|
|
| 35 |
+
| 0 | `R0_LT_1` |
|
| 36 |
+
| 1 | `R0_GE_1` |
|
| 37 |
+
|
| 38 |
+
## Performance
|
| 39 |
+
|
| 40 |
+
Held-out HVUE v2 test set, standard 1000-nt configuration:
|
| 41 |
+
|
| 42 |
+
| Metric | Score |
|
| 43 |
+
|---|---:|
|
| 44 |
+
| Accuracy | 87.50 |
|
| 45 |
+
| F1 | 86.16 |
|
| 46 |
+
| MCC | 72.66 |
|
| 47 |
+
| Precision | 86.79 |
|
| 48 |
+
| Recall | 85.64 |
|
| 49 |
+
|
| 50 |
+
## Training Details
|
| 51 |
+
|
| 52 |
+
- **Fine-tuning method:** LoRA
|
| 53 |
+
- **LoRA rank:** 8
|
| 54 |
+
- **LoRA alpha:** 16
|
| 55 |
+
- **Target modules:** query and value projections across all 12 transformer layers
|
| 56 |
+
- **Approximate trainable LoRA parameters:** ~0.3M
|
| 57 |
+
- **Learning rate:** 3e-5
|
| 58 |
+
- **Maximum input length:** 250 BPE tokens (approximately 1000 nt)
|
| 59 |
+
- **Early stopping:** patience 3, monitored using validation F1
|
| 60 |
+
- **Hardware:** NVIDIA A40 GPU
|
| 61 |
+
|
| 62 |
+
The released repository contains the full task-specific model weights rather than only the LoRA adapter.
|
| 63 |
+
|
| 64 |
+
## Usage
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
import torch
|
| 68 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 69 |
+
|
| 70 |
+
model_id = "duttaprat/HViLM-R0"
|
| 71 |
+
|
| 72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 73 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
| 74 |
+
model_id,
|
| 75 |
+
trust_remote_code=True,
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
sequence = "ATGCGTACGTTAGCCGATCGATTACGCGTACGTAGCTAGC"
|
| 79 |
+
inputs = tokenizer(
|
| 80 |
+
sequence,
|
| 81 |
+
return_tensors="pt",
|
| 82 |
+
truncation=True,
|
| 83 |
+
max_length=250,
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
with torch.no_grad():
|
| 87 |
+
logits = model(**inputs).logits
|
| 88 |
+
|
| 89 |
+
prediction_id = logits.argmax(dim=-1).item()
|
| 90 |
+
print(model.config.id2label[prediction_id])
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
Possible outputs are `R0_LT_1` and `R0_GE_1`.
|
| 94 |
+
|
| 95 |
+
## Intended Use
|
| 96 |
+
|
| 97 |
+
HViLM-R0 is intended for research and benchmarking of sequence-based transmissibility classification. The benchmark classes should not be interpreted as direct estimates of a virus's reproduction number in a specific population or outbreak.
|
| 98 |
+
|
| 99 |
+
## Related Resources
|
| 100 |
+
|
| 101 |
+
- [HViLM-base](https://huggingface.co/duttaprat/HViLM-base)
|
| 102 |
+
- [HViLM-Patho](https://huggingface.co/duttaprat/HViLM-Patho)
|
| 103 |
+
- [HViLM-Tropism](https://huggingface.co/duttaprat/HViLM-Tropism)
|
| 104 |
+
- [HVUE-v2](https://huggingface.co/datasets/duttaprat/HVUE-v2)
|
| 105 |
+
- [HViLM GitHub repository](https://github.com/duttaprat/HViLM)
|
| 106 |
+
|
| 107 |
+
## Citation
|
| 108 |
+
|
| 109 |
+
```bibtex
|
| 110 |
+
@article{dutta2026hvilm,
|
| 111 |
+
title={HViLM: A foundation model for viral genomics enables multi-task prediction of pathogenicity, transmissibility, and host tropism},
|
| 112 |
+
author={Dutta, Pratik and Vaska, Jack and Surana, Pallavi and Sathian, Rekha and Chao, Max and Zhou, Zhihan and Liu, Han and Davuluri, Ramana V},
|
| 113 |
+
journal={bioRxiv},
|
| 114 |
+
pages={2026--03},
|
| 115 |
+
year={2026},
|
| 116 |
+
publisher={Cold Spring Harbor Laboratory}
|
| 117 |
+
}
|
| 118 |
+
```
|