Downloads · 30 days
0
VIDraft/tox21-v3-models
tox21-v3-models is a tabular classification model from VIDraft. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Molecular toxicity prediction for 12 Tox21 endpoints.
Downloads · 30 days
0
Access
Public
Updated Jun 12, 2026
Repo size
855 MB
Likes
0
Public
Click a slice to open those files.
.pkl855 MB · 100%
From the Hugging Face model README
Molecular toxicity prediction for 12 Tox21 endpoints.
Target: Beat DeepTox (AUC 0.862, 1st place 2015) on the JKU Tox21 Leaderboard.
Live API: VIDraft/tox21-xgb Space
This repository contains 13 model files (12 task-specific ensemble models + 1 stacking DNN) trained on 9,158-dimensional molecular features combining:
seyonec/ChemBERTa-zinc-base-v1 [CLS] token representationPer endpoint ensemble: XGBoost (30 random seeds) + LightGBM (20 random seeds) → averaged probability.
| Category | Endpoints |
|---|---|
| Nuclear Receptors (NR) | NR-AhR, NR-AR, NR-AR-LBD, NR-Aromatase, NR-ER, NR-ER-LBD, NR-PPAR-gamma |
| Stress Response (SR) | SR-ARE, SR-ATAD5, SR-HSE, SR-MMP, SR-p53 |
SMILES Input
│
├── RDKit Fingerprints ──────────────────────── 8,390 dims
│ (ECFP4 + ECFP6 + FCFP4 + MACCS + desc)
│
└── ChemBERTa-2 [CLS] embedding ───────────── 768 dims
(seyonec/ChemBERTa-zinc-base-v1)
│
└──────────── Concatenate ─────────────────── 9,158 dims
│
┌───────────┴───────────┐
│ XGBoost × 30 seeds │ per task
│ LightGBM × 20 seeds │
└───────────┬───────────┘
│ Mean ensemble
▼
Toxicity probability
Training hyperparameters (XGBoost, per task):
n_estimators=500, max_depth=7, learning_rate=0.04subsample=0.85, colsample_bytree=0.65min_child_weight=3, reg_alpha=0.05, reg_lambda=0.3scale_pos_weight=auto (class imbalance correction)device=cuda (NVIDIA H200 GPU training)Training data: Tox21 challenge dataset, 12,060 molecules (deepchem scaffold split)
| File | Description | Size |
|---|---|---|
NR-AhR.pkl | NR-AhR ensemble model | ~14 MB |
NR-AR.pkl | NR-AR ensemble model | ~14 MB |
NR-AR-LBD.pkl | NR-AR-LBD ensemble model | ~13 MB |
NR-Aromatase.pkl | NR-Aromatase ensemble model | ~14 MB |
NR-ER.pkl | NR-ER ensemble model | ~14 MB |
NR-ER-LBD.pkl | NR-ER-LBD ensemble model | ~14 MB |
NR-PPAR-gamma.pkl | NR-PPAR-gamma ensemble model | ~13 MB |
SR-ARE.pkl | SR-ARE ensemble model | ~14 MB |
SR-ATAD5.pkl | SR-ATAD5 ensemble model | ~14 MB |
SR-HSE.pkl | SR-HSE ensemble model | ~14 MB |
SR-MMP.pkl | SR-MMP ensemble model | ~15 MB |
SR-p53.pkl | SR-p53 ensemble model | ~14 MB |
stacking_dnn.pkl | PyTorch DNN meta-learner | ~1 MB |
import requests
response = requests.post(
"https://vidraft-tox21-xgb.hf.space/predict",
json={"smiles": ["CCO", "c1ccccc1"]}
)
predictions = response.json()["predictions"]
# {"CCO": {"NR-AhR": 0.032, "NR-AR": 0.018, ...}, ...}
import pickle
import numpy as np
from huggingface_hub import hf_hub_download
# Download and load a single task model
path = hf_hub_download("VIDraft/tox21-v3-models", "NR-AhR.pkl")
with open(path, "rb") as f:
model = pickle.load(f)
# X must be 9158-dim: concatenate fingerprints (8390) + ChemBERTa [CLS] (768)
# model.predict_proba(X)[:, 1] -> toxicity probability [0, 1]
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem, MACCSkeys
from transformers import AutoTokenizer, AutoModel
import torch
def get_features(smiles: str) -> np.ndarray:
mol = Chem.MolFromSmiles(smiles)
# Fingerprints
ecfp4 = np.array(AllChem.GetMorganFingerprintAsBitVect(mol, 2, 2048), dtype=np.float32)
ecfp6 = np.array(AllChem.GetMorganFingerprintAsBitVect(mol, 3, 2048), dtype=np.float32)
fcfp4 = np.array(AllChem.GetMorganFingerprintAsBitVect(mol, 2, 2048, useFeatures=True), dtype=np.float32)
maccs = np.array(MACCSkeys.GenMACCSKeys(mol), dtype=np.float32)
ecfp4c = np.array(AllChem.GetMorganFingerprintAsBitVect(mol, 2, 2048), dtype=np.float32)
# ChemBERTa
tok = AutoTokenizer.from_pretrained("seyonec/ChemBERTa-zinc-base-v1")
m = AutoModel.from_pretrained("seyonec/ChemBERTa-zinc-base-v1").eval()
enc = tok([smiles], return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
cls_emb = m(**enc).last_hidden_state[:, 0, :].cpu().numpy()[0]
return np.concatenate([ecfp4, ecfp6, fcfp4, maccs, ecfp4c, cls_emb]) # 9158 dims
| Model | Mean AUC (12 tasks) | Year | Reference |
|---|---|---|---|
| DeepTox (1st place) | 0.862 | 2015 | Mayr et al., Front. Environ. Sci. 2016 |
| SNN | 0.856 | 2017 | — |
| VIDraft Tox21 v3 (this model) | leaderboard pending | 2026 | — |
Results will be updated after JKU leaderboard submission.
@misc{vidraft2026tox21,
title = {VIDraft Tox21 v3: ChemBERTa + XGBoost/LightGBM Ensemble for Molecular Toxicity Prediction},
author = {VIDraft},
year = {2026},
url = {https://huggingface.co/VIDraft/tox21-v3-models}
}
Apache-2.0