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
File size: 3,478 Bytes
5ac0b3a | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ---
library_name: transformers
base_model: duttaprat/HViLM-base
datasets:
- duttaprat/HVUE-v2
pipeline_tag: text-classification
tags:
- genomics
- virology
- dna
- virus
- transmissibility
- r0
- hvue-v2
license: apache-2.0
---
# HViLM-R0
**HViLM-R0** is the official HViLM model for binary virus transmissibility classification using the threshold R₀ < 1 versus R₀ ≥ 1.
- **Fine-tuned from:** [duttaprat/HViLM-base](https://huggingface.co/duttaprat/HViLM-base)
- **Benchmark:** [duttaprat/HVUE-v2](https://huggingface.co/datasets/duttaprat/HVUE-v2)
- **HVUE v2 configuration:** `Transmissibility/standard_capped_1000bp`
- **Checkpoint selection:** best validation F1 (`checkpoint-21000`)
- **Input:** virus nucleotide sequence
- **Output:** R₀ < 1 vs. R₀ ≥ 1 class
This repository contains a **standalone full fine-tuned checkpoint**, so users can load `duttaprat/HViLM-R0` directly without separately loading `HViLM-base`.
## Label Mapping
| ID | Label |
|---:|---|
| 0 | `R0_LT_1` |
| 1 | `R0_GE_1` |
## Performance
Held-out HVUE v2 test set, standard 1000-nt configuration:
| Metric | Score |
|---|---:|
| Accuracy | 87.50 |
| F1 | 86.16 |
| MCC | 72.66 |
| Precision | 86.79 |
| Recall | 85.64 |
## Training Details
- **Fine-tuning method:** LoRA
- **LoRA rank:** 8
- **LoRA alpha:** 16
- **Target modules:** query and value projections across all 12 transformer layers
- **Approximate trainable LoRA parameters:** ~0.3M
- **Learning rate:** 3e-5
- **Maximum input length:** 250 BPE tokens (approximately 1000 nt)
- **Early stopping:** patience 3, monitored using validation F1
- **Hardware:** NVIDIA A40 GPU
The released repository contains the full task-specific model weights rather than only the LoRA adapter.
## Usage
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_id = "duttaprat/HViLM-R0"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained(
model_id,
trust_remote_code=True,
)
sequence = "ATGCGTACGTTAGCCGATCGATTACGCGTACGTAGCTAGC"
inputs = tokenizer(
sequence,
return_tensors="pt",
truncation=True,
max_length=250,
)
with torch.no_grad():
logits = model(**inputs).logits
prediction_id = logits.argmax(dim=-1).item()
print(model.config.id2label[prediction_id])
```
Possible outputs are `R0_LT_1` and `R0_GE_1`.
## Intended Use
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.
## Related Resources
- [HViLM-base](https://huggingface.co/duttaprat/HViLM-base)
- [HViLM-Patho](https://huggingface.co/duttaprat/HViLM-Patho)
- [HViLM-Tropism](https://huggingface.co/duttaprat/HViLM-Tropism)
- [HVUE-v2](https://huggingface.co/datasets/duttaprat/HVUE-v2)
- [HViLM GitHub repository](https://github.com/duttaprat/HViLM)
## Citation
```bibtex
@article{dutta2026hvilm,
title={HViLM: A foundation model for viral genomics enables multi-task prediction of pathogenicity, transmissibility, and host tropism},
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},
journal={bioRxiv},
pages={2026--03},
year={2026},
publisher={Cold Spring Harbor Laboratory}
}
```
|