CoolFace
Modelpublic

dsuram/distilbert-mentalhealth-classifier

sourceHugging Facemitupdated 1y agoView on Hugging Face
2likes37downloads
Model Card

๐Ÿง  DistilBERT Mental Health Classifier

This model is a fine-tuned version of `distilbert-base-uncased` for mental health condition classification. It is trained on a custom dataset containing user statements labeled with categories such as depression, anxiety, PTSD, and more.

๐Ÿง  Use Case

This model is designed for:

Early detection of mental health symptoms in user conversations

Clinical research on NLP-based diagnostic support

AI assistants that provide empathetic triage or support

๐Ÿงช Performance

The model shows significant improvements after fine-tuning:

Sample SizeAccuracy (Before)F1 Score (Before)Accuracy (After)F1 Score (After)
200 Samples0.0750.01420.8300.8267
500 Samples0.0700.01410.8560.8544

โœ… These results indicate that fine-tuning with a high-quality mental health dataset enables DistilBERT to make informed predictions from free-form user input.

๐Ÿ“š Dataset

The model was fine-tuned on FilteredCombinedData.csv, a curated dataset of 42,000+ statements labeled across multiple mental health categories. Each sample includes:

statement โ€” a natural language user message

label โ€” a mental health condition such as "Depression", "Anxiety", or "Healthy"

๐Ÿ—๏ธ Prompt Format (used during fine-tuning)

text Copy Edit

Instruction:

Classify the mental health condition in the following statement.

Input: {text}

Response: {label} This instruction format aligns the classifier with instruction-tuned language models.


๐Ÿง  Labels Covered

The model classifies input statements into the following mental health categories (example):

  • โ€”Anxiety
  • โ€”Depression
  • โ€”PTSD
  • โ€”OCD
  • โ€”Bipolar Disorder
  • โ€”ADHD
  • โ€”Healthy
  • โ€”Others (as labeled in dataset)

โš™๏ธ Training Configuration

  • โ€”Base Model: distilbert-base-uncased
  • โ€”Epochs: 3
  • โ€”Total Steps: ~36,500
  • โ€”Batch Size: 16
  • โ€”Max Length: 512
  • โ€”Quantization: None
  • โ€”Learning Rate: 2e-5
  • โ€”Optimizer: AdamW
  • โ€”Evaluation: Accuracy, Weighted F1

๐Ÿ“‚ Model Files

  • โ€”pytorch_model.bin โ€” fine-tuned model weights
  • โ€”tokenizer_config.json, vocab.txt, etc. โ€” tokenizer files
  • โ€”config.json โ€” architecture and label mapping
  • โ€”README.md โ€” this file

๐Ÿ“„ License

This model is licensed under the MIT License โ€” free for personal, academic, and commercial use with attribution.


๐Ÿ™‹ Author

Developed by Dileep Reddy Suram ๐Ÿ“ For multimodal clinical AI assistant research and PhD preparation ๐Ÿ”— Hugging Face Profile


๐Ÿš€ Citation

If you use this model, please cite:

๐Ÿ“ฆ How to Use (Quick Start)

python
from transformers import pipeline

classifier = pipeline("text-classification", model="dsuram/distilbert-mentalhealth-classifier")
classifier("I feel anxious all the time and can't concentrate.")
---
๐Ÿงช Inference (Advanced)
You can also use the tokenizer + model directly:


from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

#### Load model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("dsuram/distilbert-mentalhealth-classifier")
tokenizer = AutoTokenizer.from_pretrained("dsuram/distilbert-mentalhealth-classifier")

# Input text
text = "I feel lost, hopeless, and don't see a way out."

# Tokenize and predict
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
outputs = model(**inputs)
logits = outputs.logits
predicted_class_id = torch.argmax(logits, dim=1).item()

# Map to label
label_map = model.config.id2label
print(f"Predicted label: {label_map[predicted_class_id]}")
---