Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- text-classification
|
| 5 |
+
- emotional-support
|
| 6 |
+
- empathy
|
| 7 |
+
- mental-health
|
| 8 |
+
license: mit
|
| 9 |
+
datasets:
|
| 10 |
+
- esconv
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Emotional Support Strategy Classifier
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned RoBERTa-base model for classifying emotional support conversation strategies.
|
| 16 |
+
|
| 17 |
+
## Model Description
|
| 18 |
+
|
| 19 |
+
- **Base Model**: roberta-base
|
| 20 |
+
- **Task**: Multi-class text classification
|
| 21 |
+
- **Training Data**: ESConv (Emotional Support Conversation) dataset
|
| 22 |
+
- **Number of Labels**: 8
|
| 23 |
+
|
| 24 |
+
## Labels
|
| 25 |
+
|
| 26 |
+
The model classifies text into 8 emotional support strategies:
|
| 27 |
+
|
| 28 |
+
0. Affirmation and Reassurance
|
| 29 |
+
1. Information
|
| 30 |
+
2. Others
|
| 31 |
+
3. Providing Suggestions
|
| 32 |
+
4. Question
|
| 33 |
+
5. Reflection of feelings
|
| 34 |
+
6. Restatement or Paraphrasing
|
| 35 |
+
7. Self-disclosure
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 41 |
+
import torch
|
| 42 |
+
|
| 43 |
+
# Load model and tokenizer
|
| 44 |
+
model_name = "RyanDDD/empathy-strategy-classifier"
|
| 45 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 46 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 47 |
+
|
| 48 |
+
# Example prediction
|
| 49 |
+
text = "I understand how you feel. It's completely normal to feel this way."
|
| 50 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
| 51 |
+
outputs = model(**inputs)
|
| 52 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 53 |
+
predicted_class = torch.argmax(predictions, dim=-1).item()
|
| 54 |
+
|
| 55 |
+
print(f"Predicted strategy: {model.config.id2label[predicted_class]}")
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Training
|
| 59 |
+
|
| 60 |
+
Fine-tuned on the ESConv dataset using the Hugging Face Transformers library.
|
| 61 |
+
|
| 62 |
+
## Citation
|
| 63 |
+
|
| 64 |
+
If you use this model, please cite the ESConv dataset:
|
| 65 |
+
|
| 66 |
+
```bibtex
|
| 67 |
+
@inproceedings{liu2021towards,
|
| 68 |
+
title={Towards Emotional Support Dialog Systems},
|
| 69 |
+
author={Liu, Siyang and Zheng, Chujie and Demasi, Orianna and Sabour, Sahand and Li, Yu and Yu, Zhou and Jiang, Yong and Huang, Minlie},
|
| 70 |
+
booktitle={Proceedings of ACL},
|
| 71 |
+
year={2021}
|
| 72 |
+
}
|
| 73 |
+
```
|