Downloads · 30 days
1K
17% of all-time downloads
SajjadIslam/multiMentalRoBERTA-5-class
multiMentalRoBERTA-5-class is a text classification model from SajjadIslam. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
multiMentalRoBERTa 5 class is a fine tuned RoBERTa large model for multiclass detection of common mental health conditions from short social media texts. It classifies into five categories that exclude stress to reduc…
Downloads · 30 days
1K
17% of all-time downloads
All-time downloads
6K
Public
Parameters
355M
1.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
multiMentalRoBERTa 5 class is a fine tuned RoBERTa large model for multiclass detection of common mental health conditions from short social media texts. It classifies into five categories that exclude stress to reduce overlap and improve separability. In controlled experiments it achieved macro F1 of 0.870 and macro recall of 0.869, outperforming strong baselines and domain adapted transformers.
This model is not a medical device and must not be used for diagnosis or crisis determination without qualified human oversight.
The exact mapping is stored in the config and should be read programmatically. The five classes correspond to: Anxiety, Depression, PTSD, Suicidal, and None. The learned numeric ids come from the saved config.
from transformers import AutoConfig
cfg = AutoConfig.from_pretrained("SajjadIslam/multiMentalRoBERTA-5-class")
print(cfg.id2label) # authoritative mapping
Data combines curated Reddit corpora and stress resources, with neutral text for contrast. The five class setting removes stress to reduce linguistic overlap that otherwise confounds anxiety and PTSD and also the depression and suicidal boundary. (More details on the paper)
from transformers import pipeline
clf = pipeline("text-classification", model="SajjadIslam/multiMentalRoBERTA-5-class", top_k=None, truncation=True)
text = "I feel stuck and cannot sleep from worry."
print(clf(text))
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
MAX_LENGTH = 512
repo = "SajjadIslam/multiMentalRoBERTA-5-class"
tok = AutoTokenizer.from_pretrained(repo, use_fast=True)
mdl = AutoModelForSequenceClassification.from_pretrained(repo).to(DEVICE).eval()
id2label = {int(k): v for k, v in mdl.config.id2label.items()}
@torch.no_grad()
def classify_5(text: str):
enc = tok(text, truncation=True, padding="max_length", max_length=MAX_LENGTH, return_tensors="pt").to(DEVICE)
logits = mdl(**enc).logits
probs = torch.softmax(logits, dim=-1)[0].cpu().numpy()
pid = int(torch.argmax(logits, dim=-1).item())
return {
"predicted_class": id2label[pid],
"confidence": float(probs[pid]),
"probabilities": {id2label[i]: float(probs[i]) for i in range(len(probs))}
}
Use with human review and escalation pathways. Document decision policies, monitor drift, and avoid deployment in settings that could result in harm without professional support. Summary findings and safety notes are discussed in the paper.
If you use this model, please cite:
@inproceedings{islam2025multimentalroberta,
title={multiMentalRoBERTa: A Fine-tuned Multiclass Classifier for Mental Health Disorder},
author={Islam, KM Sajjadul and Fields, John and Madiraju, Praveen},
booktitle={2025 IEEE International Conference on Big Data (BigData)},
pages={3255--3264},
year={2025},
organization={IEEE}
}