Viro-BERT

Whole-genome Transformer framework for viral pathogen classification across 14 viral classes using Chunk-and-Vote Late Fusion Consensus.


Requirements

pip install torch transformers biopython

Tested on Python 3.8+ and PyTorch 1.13+ (supports CPU and CUDA).


Files in Repository

  • sota_chunk_model.pth β€” Trained PyTorch model weights (DistilBERT backbone, 6 layers, 12 heads, hidden dim 768).
  • config.json β€” 130-token 3-mer vocabulary, hyperparameters, and 14 target class mappings.
  • predict.py β€” Standalone inference script for FASTA sequence classification.

Command-Line Usage (Python)

Classify viral sequences from a FASTA file:

python predict.py --fasta sample.fasta

Optional arguments:

python predict.py --fasta sample.fasta --weights sota_chunk_model.pth --config config.json --top_k 3 --cpu

Execution via R

Run directly from an R environment via system command:

system("python predict.py --fasta sample.fasta")

Or programmatically via the reticulate interface:

library(reticulate)
py_run_file("predict.py")

Target Viral Classes (14)

  • Dengue Virus (Dengue)
  • Enterovirus A (EnteroA)
  • Enterovirus B (EnteroB)
  • Hepatitis B Virus (HBV)
  • Hepatitis C Virus (HCV)
  • Human Papillomavirus (HPV)
  • Human Alphaherpesvirus 1 (HSV-1)
  • Influenza A Virus (IAV)
  • Influenza B Virus (IBV)
  • Influenza C Virus (ICV)
  • Monkeypox Virus (MPV)
  • Severe Fever with Thrombocytopenia Syndrome Virus (SFTS)
  • West Nile Virus (WNV)
  • Zika Virus (Zika)

License

Open access under the MIT License.


Downloads last month
49
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support