google-research-datasets/go_emotions
Viewer • Updated • 265k • 22k • 260
How to use Frankhihi/fast-emotion-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Frankhihi/fast-emotion-classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Frankhihi/fast-emotion-classifier")
model = AutoModelForSequenceClassification.from_pretrained("Frankhihi/fast-emotion-classifier")High-performance emotion classification model achieving 87.1% accuracy on 7 Ekman emotions.
Built with DistilBERT and optimized for speed and accuracy, trained on 43K+ GoEmotions samples.
The model predicts 7 Ekman emotions:
| Label | Emotion | Accuracy | Examples |
|---|---|---|---|
| LABEL_0 | anger | 80% | "I am so furious about this situation" |
| LABEL_1 | disgust | 50% | "This is absolutely disgusting" |
| LABEL_2 | fear | 100% | "I'm terrified of what might happen" |
| LABEL_3 | joy | 100% | "I feel so happy and joyful today" |
| LABEL_4 | sadness | 100% | "This makes me feel so sad" |
| LABEL_5 | surprise | 80% | "What an unexpected turn of events" |
| LABEL_6 | neutral | 100% | "The meeting is scheduled for Tuesday" |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
# Load model
model_name = "bijdolphin/fast-emotion-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Create pipeline
classifier = pipeline(
"text-classification",
model=model,
tokenizer=tokenizer,
return_all_scores=True
)
# Classify emotions
text = "I am so excited about this amazing news!"
result = classifier(text)
print(result)
EMOTIONS = {
'LABEL_0': 'anger',
'LABEL_1': 'disgust',
'LABEL_2': 'fear',
'LABEL_3': 'joy',
'LABEL_4': 'sadness',
'LABEL_5': 'surprise',
'LABEL_6': 'neutral'
}
Overall Accuracy: 87.14%
Weighted F1-Score: 86.55%
Macro F1-Score: 86.55%
Per-class Performance:
- Joy: 100% (Perfect)
- Fear: 100% (Perfect)
- Sadness: 100% (Perfect)
- Neutral: 100% (Perfect)
- Anger: 80% (Strong)
- Surprise: 80% (Strong)
- Disgust: 50% (Needs improvement)
texts = [
"I love this so much!",
"This makes me really angry",
"I'm worried about tomorrow"
]
results = classifier(texts)
for text, result in zip(texts, results):
best = max(result, key=lambda x: x['score'])
emotion = best['label'].replace('LABEL_', '')
emotions = ['anger', 'disgust', 'fear', 'joy', 'sadness', 'surprise', 'neutral']
print(f"{text} → {emotions[int(emotion)]} ({best['score']:.2%})")
import torch
def predict_emotions(texts, model, tokenizer):
inputs = tokenizer(texts, return_tensors='pt', truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
return probabilities.numpy()
The model shows excellent training dynamics:
@misc{fast-emotion-classifier-2025,
title={Fast Emotion Classifier: High-Performance DistilBERT for Emotion Classification},
author={bijdolphin},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/bijdolphin/fast-emotion-classifier}
}
This model is licensed under the MIT License.