Downloads · 30 days
0
amirbhat/motivbot-multilingual-mdeberta-v4
motivbot-multilingual-mdeberta-v4 is a machine learning model from amirbhat. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model uses mDeBERTa‑v3‑base with CLS+mean pooling and structured features (Age, Gender, PHQ‑9, RSES). It is the best single fold (4) from a 5‑fold ensemble trained with: - Longer context (384 tokens) - LLRD (back…
Downloads · 30 days
0
Access
Public
Updated Jun 19, 2026
Repo size
1.7 GB
Likes
0
Public
Click a slice to open those files.
.bin576 MB · 97%
From the Hugging Face model README
This model uses mDeBERTa‑v3‑base with CLS+mean pooling and structured features (Age, Gender, PHQ‑9, RSES).
It is the best single fold (4) from a 5‑fold ensemble trained with:
Validation ternary macro‑F1: 0.7166
import torch
import json
from transformers import AutoTokenizer
from modeling import MentalHealthClassifierV6
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
with open("model_config.json") as f:
config = json.load(f)
with open("preprocess_stats.json") as f:
stats = json.load(f)
model = MentalHealthClassifierV6(model_name=config["model_name"])
model.load_state_dict(torch.load("pytorch_model.bin", map_location=device))
model.to(device).eval()
tokenizer = AutoTokenizer.from_pretrained(".")
# Normalise structured features using stats:
age_norm = (age - stats['num_mean']['Age']) / stats['num_std']['Age']
phq9_norm = (phq9 - stats['num_mean']['PHQ9']) / stats['num_std']['PHQ9']
rses_norm = (rses - stats['num_mean']['RSES']) / stats['num_std']['RSES']
gender_enc = {'male':0, 'female':1, 'other':2}.get(gender.lower(), 2)
gender_norm = (gender_enc - stats['g_mean']) / stats['g_std']
struct = torch.tensor([[age_norm, phq9_norm, rses_norm, gender_norm]], dtype=torch.float32).to(device)
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=config["max_len"]).to(device)
with torch.no_grad():
logits = model(inputs["input_ids"], inputs["attention_mask"], struct)
probs = [torch.softmax(l, dim=1).cpu().numpy() for l in logits]