Commit
·
e12353f
0
Parent(s):
Update README and model files
Browse files- .DS_Store +0 -0
- .gitattributes +1 -0
- README.md +57 -0
- config.json +35 -0
- model.safetensors +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +56 -0
- training_args.bin +0 -0
- vocab.txt +0 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🧠 DistilBERT Response Type Classifier
|
| 2 |
+
|
| 3 |
+
This is a fine-tuned [DistilBERT](https://huggingface.co/distilbert-base-uncased) model designed to classify patient messages into one of four mental health support categories:
|
| 4 |
+
|
| 5 |
+
- **advice**
|
| 6 |
+
- **information**
|
| 7 |
+
- **question**
|
| 8 |
+
- **validation**
|
| 9 |
+
|
| 10 |
+
It is used as part of the [Mental Health Counselor Assistant](https://huggingface.co/spaces/scdong/counselor-assistant) app to help generate helpful, therapeutic responses.
|
| 11 |
+
|
| 12 |
+
## 💼 Use Case
|
| 13 |
+
|
| 14 |
+
Given a short text input from a patient, this model predicts the most appropriate **type of response** a mental health counselor might provide.
|
| 15 |
+
|
| 16 |
+
### Example:
|
| 17 |
+
```python
|
| 18 |
+
from transformers import DistilBertForSequenceClassification, DistilBertTokenizerFast
|
| 19 |
+
import torch
|
| 20 |
+
|
| 21 |
+
model = DistilBertForSequenceClassification.from_pretrained("scdong/distilbert-response-type")
|
| 22 |
+
tokenizer = DistilBertTokenizerFast.from_pretrained("scdong/distilbert-response-type")
|
| 23 |
+
|
| 24 |
+
text = "I just feel so overwhelmed lately"
|
| 25 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 26 |
+
with torch.no_grad():
|
| 27 |
+
logits = model(**inputs).logits
|
| 28 |
+
|
| 29 |
+
predicted_label = torch.argmax(logits, dim=1).item()
|
| 30 |
+
print(predicted_label) # Maps to: 0=advice, 1=information, 2=question, 3=validation
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The model is used to route text to custom prompt templates like:
|
| 34 |
+
- *Advice prompt*: “You are a licensed counselor. What supportive advice would you give to someone who said: {msg}?”
|
| 35 |
+
- *Validation prompt*: “You are an empathetic therapist. Validate the client’s emotions in response to: {msg}”
|
| 36 |
+
|
| 37 |
+
## 📁 Files
|
| 38 |
+
|
| 39 |
+
This repo includes:
|
| 40 |
+
- `config.json` — model architecture config
|
| 41 |
+
- `model.safetensors` — trained model weights
|
| 42 |
+
- `tokenizer_config.json`, `tokenizer.json`, `vocab.txt` — tokenizer files
|
| 43 |
+
- `special_tokens_map.json` — optional token mappings
|
| 44 |
+
- `training_args.bin` — training metadata (optional)
|
| 45 |
+
|
| 46 |
+
## 🧪 Training Details
|
| 47 |
+
|
| 48 |
+
The model was fine-tuned using a balanced dataset labeled with response types based on:
|
| 49 |
+
- [Kaggle Mental Health Conversations](https://www.kaggle.com/datasets/ayaanalahmed/mental-health-conversations)
|
| 50 |
+
- [CounselChat dataset](https://github.com/nbertagnolli/counsel-chat)
|
| 51 |
+
- [PAIR dataset](https://lit.eecs.umich.edu/downloads.html#PAIR)
|
| 52 |
+
|
| 53 |
+
The final model was validated on a held-out test set and integrated into the counselor assistant tool.
|
| 54 |
+
|
| 55 |
+
## 📜 License
|
| 56 |
+
|
| 57 |
+
This model is released under an open license for research and educational purposes. Please use responsibly and do not deploy for unsupervised clinical use.
|
config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"id2label": {
|
| 11 |
+
"0": "LABEL_0",
|
| 12 |
+
"1": "LABEL_1",
|
| 13 |
+
"2": "LABEL_2",
|
| 14 |
+
"3": "LABEL_3"
|
| 15 |
+
},
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"label2id": {
|
| 18 |
+
"LABEL_0": 0,
|
| 19 |
+
"LABEL_1": 1,
|
| 20 |
+
"LABEL_2": 2,
|
| 21 |
+
"LABEL_3": 3
|
| 22 |
+
},
|
| 23 |
+
"max_position_embeddings": 512,
|
| 24 |
+
"model_type": "distilbert",
|
| 25 |
+
"n_heads": 12,
|
| 26 |
+
"n_layers": 6,
|
| 27 |
+
"pad_token_id": 0,
|
| 28 |
+
"qa_dropout": 0.1,
|
| 29 |
+
"seq_classif_dropout": 0.2,
|
| 30 |
+
"sinusoidal_pos_embds": false,
|
| 31 |
+
"tie_weights_": true,
|
| 32 |
+
"torch_dtype": "float32",
|
| 33 |
+
"transformers_version": "4.51.3",
|
| 34 |
+
"vocab_size": 30522
|
| 35 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ecf29c46c297b4f1cdf81a91225e0abe2ccc5add77a0d9a90409aac2d535ee22
|
| 3 |
+
size 267838720
|
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 |
+
}
|
training_args.bin
ADDED
|
Binary file (5.24 kB). View file
|
|
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|