File size: 2,079 Bytes
f2b5966
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---

language: en
license: mit
tags:
  - text-classification
  - depression
  - mental-health
  - huggingface
datasets:
  - thePixel42/depression-detection
  - infamouscoder/depression-reddit-cleaned
model-index:
  - name: DistilBERT for Depression Detection
    results:
      - task:
          name: Text Classification
          type: text-classification
        metrics:
          - name: Evaluation Loss
            type: loss
            value: 0.0631
---


# DistilBERT for Depression Detection

This model is a fine-tuned version of `distilbert-base-uncased` for binary depression classification based on Reddit and mental health-related posts.

## 📊 Training Details

- **Base model**: distilbert-base-uncased
- **Epochs**: 3
- **Batch size**: 8 (train), 16 (eval)
- **Optimizer**: AdamW with weight decay
- **Loss function**: CrossEntropyLoss
- **Hardware**: Trained using GPU acceleration

## 🧾 Datasets Used

- [thePixel42/depression-detection](https://huggingface.co/datasets/thePixel42/depression-detection)
- [infamouscoder/depression-reddit-cleaned](https://www.kaggle.com/datasets/infamouscoder/depression-reddit-cleaned)

The datasets were cleaned to remove rows with missing `text`, labels were binarized (0 = not depressed, 1 = depressed), and duplicates were removed.

## 🧪 Evaluation

| Metric              | Value     |
|---------------------|-----------|
| Loss                | 0.0631    |
| Samples/sec         | 85.56     |
| Steps/sec           | 5.35      |

## 🚀 Usage

```python

from transformers import AutoModelForSequenceClassification, AutoTokenizer

import torch



model = AutoModelForSequenceClassification.from_pretrained("your-username/depression-detection-model")

tokenizer = AutoTokenizer.from_pretrained("your-username/depression-detection-model")



inputs = tokenizer("I feel sad and hopeless", return_tensors="pt")

with torch.no_grad():

    logits = model(**inputs).logits

    predicted_class = torch.argmax(logits).item()



print("Prediction:", predicted_class)