dair-ai/emotion
Viewer β’ Updated β’ 437k β’ 31.5k β’ 464
How to use lucky377/emotion_classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="lucky377/emotion_classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("lucky377/emotion_classifier")
model = AutoModelForSequenceClassification.from_pretrained("lucky377/emotion_classifier", device_map="auto")This repository hosts a fine-tuned DistilBERT model for text emotion classification, trained on the dair-ai/emotion dataset.
It categorizes English text into 6 distinct emotional classes:
sadness (0)joy (1)love (2)anger (3)fear (4)surprise (5)distilbert-base-uncased)dair-ai/emotion (20,000 annotated text snippets)en)| Label ID | Emotion Tag | Description & Typical Mood Indicators |
|---|---|---|
0 |
sadness | Feelings of sorrow, heartbreak, grief, disappointment, or loneliness |
1 |
joy | Happiness, excitement, achievement, satisfaction, and delight |
2 |
love | Warmth, affection, appreciation, gratitude, and romantic connection |
3 |
anger | Frustration, annoyance, rage, irritation, and hostility |
4 |
fear | Anxiety, apprehension, nervousness, panic, and terror |
5 |
surprise | Astonishment, awe, unexpected news, and shock |
transformers Pipeline
from transformers import pipeline
# Initialize the text classification pipeline
classifier = pipeline(
"text-classification",
model="lucky377/emotion_classifier",
return_all_scores=True
)
text = "I am so happy and excited about this new project!"
predictions = classifier(text)
print(predictions)