Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DeBERTa Mental Health Classification Model
|
| 2 |
+
|
| 3 |
+
A fine-tuned DeBERTa v3 small model for detecting mental health conditions from text.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
tags:
|
| 8 |
+
|
| 9 |
+
- text-classification
|
| 10 |
+
- mental-health
|
| 11 |
+
- deberta-v3
|
| 12 |
+
- pytorch
|
| 13 |
+
- transformers
|
| 14 |
+
- sentiment-analysis
|
| 15 |
+
- healthcare
|
| 16 |
+
language:
|
| 17 |
+
- en
|
| 18 |
+
license: mit
|
| 19 |
+
datasets:
|
| 20 |
+
- AIMH/SWMH
|
| 21 |
+
metrics:
|
| 22 |
+
- accuracy
|
| 23 |
+
- f1
|
| 24 |
+
pipeline_tag: text-classification
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## Model Description
|
| 29 |
+
|
| 30 |
+
This model is based on `microsoft/deberta-v3-small` and has been fine-tuned to classify text into 8 mental health categories.
|
| 31 |
+
|
| 32 |
+
## Training Data
|
| 33 |
+
|
| 34 |
+
This model was trained on the following datasets:
|
| 35 |
+
|
| 36 |
+
- **SWMH (Social Media Mental Health Dataset)**: [AIMH/SWMH](https://huggingface.co/datasets/AIMH/SWMH)
|
| 37 |
+
- **Sentiment Analysis for Mental Health**: [Kaggle Dataset](https://www.kaggle.com/datasets/suchintikasarkar/sentiment-analysis-for-mental-health)
|
| 38 |
+
|
| 39 |
+
## Labels
|
| 40 |
+
|
| 41 |
+
The model can classify text into the following categories:
|
| 42 |
+
|
| 43 |
+
| ID | Label | Description |
|
| 44 |
+
| --- | -------------------- | --------------------------------------------------- |
|
| 45 |
+
| 0 | Normal | No mental health concerns detected |
|
| 46 |
+
| 1 | Offmychest | General venting/sharing |
|
| 47 |
+
| 2 | Depression | Depression-related content |
|
| 48 |
+
| 3 | Anxiety | Anxiety-related content |
|
| 49 |
+
| 4 | Stress | Stress-related content |
|
| 50 |
+
| 5 | Bipolar | Bipolar disorder-related content |
|
| 51 |
+
| 6 | Personality disorder | Personality disorder-related content |
|
| 52 |
+
| 7 | Suicidal | Suicidal ideation (⚠️ requires immediate attention) |
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 58 |
+
import torch
|
| 59 |
+
|
| 60 |
+
# Load model and tokenizer
|
| 61 |
+
model_path = "deberta-illness"
|
| 62 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 63 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 64 |
+
|
| 65 |
+
# Example text
|
| 66 |
+
text = "I've been feeling down lately and can't seem to enjoy anything anymore."
|
| 67 |
+
|
| 68 |
+
# Tokenize and predict
|
| 69 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
| 70 |
+
outputs = model(**inputs)
|
| 71 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 72 |
+
|
| 73 |
+
# Get predicted label
|
| 74 |
+
predicted_class = torch.argmax(predictions, dim=-1).item()
|
| 75 |
+
confidence = predictions[0][predicted_class].item()
|
| 76 |
+
|
| 77 |
+
print(f"Predicted: {model.config.id2label[str(predicted_class)]}")
|
| 78 |
+
print(f"Confidence: {confidence:.2%}")
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Model Architecture
|
| 82 |
+
|
| 83 |
+
- **Base Model:** microsoft/deberta-v3-small
|
| 84 |
+
- **Hidden Size:** 768
|
| 85 |
+
- **Attention Heads:** 12
|
| 86 |
+
- **Hidden Layers:** 6
|
| 87 |
+
- **Max Sequence Length:** 512 tokens
|
| 88 |
+
- **Vocabulary Size:** 128,100
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
Please refer to the original microsoft/deberta-v3-small license and any additional licensing terms from the fine-tuning dataset.
|