Upload folder using huggingface_hub
Browse files- README.md +66 -0
- config.json +24 -0
- model.safetensors +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +56 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- text-classification
|
6 |
+
- depression
|
7 |
+
- mental-health
|
8 |
+
- huggingface
|
9 |
+
datasets:
|
10 |
+
- thePixel42/depression-detection
|
11 |
+
- infamouscoder/depression-reddit-cleaned
|
12 |
+
model-index:
|
13 |
+
- name: DistilBERT for Depression Detection
|
14 |
+
results:
|
15 |
+
- task:
|
16 |
+
name: Text Classification
|
17 |
+
type: text-classification
|
18 |
+
metrics:
|
19 |
+
- name: Evaluation Loss
|
20 |
+
type: loss
|
21 |
+
value: 0.0631
|
22 |
+
---
|
23 |
+
|
24 |
+
# DistilBERT for Depression Detection
|
25 |
+
|
26 |
+
This model is a fine-tuned version of `distilbert-base-uncased` for binary depression classification based on Reddit and mental health-related posts.
|
27 |
+
|
28 |
+
## 📊 Training Details
|
29 |
+
|
30 |
+
- **Base model**: distilbert-base-uncased
|
31 |
+
- **Epochs**: 3
|
32 |
+
- **Batch size**: 8 (train), 16 (eval)
|
33 |
+
- **Optimizer**: AdamW with weight decay
|
34 |
+
- **Loss function**: CrossEntropyLoss
|
35 |
+
- **Hardware**: Trained using GPU acceleration
|
36 |
+
|
37 |
+
## 🧾 Datasets Used
|
38 |
+
|
39 |
+
- [thePixel42/depression-detection](https://huggingface.co/datasets/thePixel42/depression-detection)
|
40 |
+
- [infamouscoder/depression-reddit-cleaned](https://www.kaggle.com/datasets/infamouscoder/depression-reddit-cleaned)
|
41 |
+
|
42 |
+
The datasets were cleaned to remove rows with missing `text`, labels were binarized (0 = not depressed, 1 = depressed), and duplicates were removed.
|
43 |
+
|
44 |
+
## 🧪 Evaluation
|
45 |
+
|
46 |
+
| Metric | Value |
|
47 |
+
|---------------------|-----------|
|
48 |
+
| Loss | 0.0631 |
|
49 |
+
| Samples/sec | 85.56 |
|
50 |
+
| Steps/sec | 5.35 |
|
51 |
+
|
52 |
+
## 🚀 Usage
|
53 |
+
|
54 |
+
```python
|
55 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
56 |
+
import torch
|
57 |
+
|
58 |
+
model = AutoModelForSequenceClassification.from_pretrained("your-username/depression-detection-model")
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained("your-username/depression-detection-model")
|
60 |
+
|
61 |
+
inputs = tokenizer("I feel sad and hopeless", return_tensors="pt")
|
62 |
+
with torch.no_grad():
|
63 |
+
logits = model(**inputs).logits
|
64 |
+
predicted_class = torch.argmax(logits).item()
|
65 |
+
|
66 |
+
print("Prediction:", predicted_class)
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"activation": "gelu",
|
3 |
+
"architectures": [
|
4 |
+
"DistilBertForSequenceClassification"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.1,
|
7 |
+
"dim": 768,
|
8 |
+
"dropout": 0.1,
|
9 |
+
"hidden_dim": 3072,
|
10 |
+
"initializer_range": 0.02,
|
11 |
+
"max_position_embeddings": 512,
|
12 |
+
"model_type": "distilbert",
|
13 |
+
"n_heads": 12,
|
14 |
+
"n_layers": 6,
|
15 |
+
"pad_token_id": 0,
|
16 |
+
"problem_type": "single_label_classification",
|
17 |
+
"qa_dropout": 0.1,
|
18 |
+
"seq_classif_dropout": 0.2,
|
19 |
+
"sinusoidal_pos_embds": false,
|
20 |
+
"tie_weights_": true,
|
21 |
+
"torch_dtype": "float32",
|
22 |
+
"transformers_version": "4.51.3",
|
23 |
+
"vocab_size": 30522
|
24 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:076a8d27d2ee6b9e53210d4a40d6a5fc2d3b46eca3d7330b6301d14100169086
|
3 |
+
size 267832560
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": false,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_lower_case": true,
|
47 |
+
"extra_special_tokens": {},
|
48 |
+
"mask_token": "[MASK]",
|
49 |
+
"model_max_length": 512,
|
50 |
+
"pad_token": "[PAD]",
|
51 |
+
"sep_token": "[SEP]",
|
52 |
+
"strip_accents": null,
|
53 |
+
"tokenize_chinese_chars": true,
|
54 |
+
"tokenizer_class": "DistilBertTokenizer",
|
55 |
+
"unk_token": "[UNK]"
|
56 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|