File size: 1,292 Bytes
206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 206a93a 66fcef0 | 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 | ---
language: en
license: mit
library_name: transformers
tags:
- emotion
- text-classification
- roberta
datasets:
- dair-ai/emotion
metrics:
- accuracy
- f1
pipeline_tag: text-classification
---
# Emotion Text Classifier (RoBERTa)
A fine-tuned `roberta-base` model for classifying text into 6 emotions:
**sadness, joy, love, anger, fear, surprise**.
## Training Details
- **Base model:** `roberta-base`
- **Dataset:** [dair-ai/emotion](https://huggingface.co/datasets/dair-ai/emotion) (20k train / 2k val / 2k test)
- **Epochs:** 5
- **Learning rate:** 2e-5
- **Batch size:** 16
- **Weight decay:** 0.01
- **Best model selection:** accuracy on validation set
- **Mixed precision:** fp16 (trained on T4 GPU)
## Results
Update these with your actual results after training:
| Metric | Score |
|--------|-------|
| Test Accuracy | ~93% |
| Weighted F1 | ~93% |
## Usage
```python
from transformers import pipeline
classifier = pipeline("text-classification", model="dk409/emotion-roberta", top_k=None)
result = classifier("I'm so happy today!")
print(result)
# [[{{'label': 'joy', 'score': 0.98}}, {{'label': 'love', 'score': 0.01}}, ...]]
```
## Labels
| ID | Label |
|----|-------|
| 0 | sadness |
| 1 | joy |
| 2 | love |
| 3 | anger |
| 4 | fear |
| 5 | surprise |
|