dair-ai/emotion
Viewer • Updated • 437k • 33.7k • 443
How to use dk409/emotion-roberta with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="dk409/emotion-roberta") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("dk409/emotion-roberta")
model = AutoModelForSequenceClassification.from_pretrained("dk409/emotion-roberta")A fine-tuned roberta-base model for classifying text into 6 emotions:
sadness, joy, love, anger, fear, surprise.
roberta-baseUpdate these with your actual results after training:
| Metric | Score |
|---|---|
| Test Accuracy | ~93% |
| Weighted F1 | ~93% |
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}}, ...]]
| ID | Label |
|---|---|
| 0 | sadness |
| 1 | joy |
| 2 | love |
| 3 | anger |
| 4 | fear |
| 5 | surprise |