Downloads · 30 days
11
15% of all-time downloads
xxxier/distilbert-emotion-classifier
distilbert-emotion-classifier is a text classification model from xxxier. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned DistilBERT model for emotion classification on Twitter text data.
Downloads · 30 days
11
15% of all-time downloads
All-time downloads
72
Public
Repo size
536 MB
Likes
0
Public
Click a slice to open those files.
.bin268 MB · 100%
From the Hugging Face model README
A fine-tuned DistilBERT model for emotion classification on Twitter text data.
This model is a fine-tuned version of distilbert-base-uncased on the emotion dataset. It classifies text into 6 emotion categories.
| Label ID | Emotion |
|---|---|
| 0 | sadness |
| 1 | joy |
| 2 | love |
| 3 | anger |
| 4 | fear |
| 5 | surprise |
| Metric | Value |
|---|---|
| Test Accuracy | 92.8% |
| Test F1 (weighted) | 0.9276 |
| Validation Accuracy (best) | 93.55% |
| Epoch | Validation Accuracy | Validation Loss |
|---|---|---|
| 1 | 92.45% | 0.215 |
| 2 | 93.55% | 0.164 |
| 3 | 93.9% | 0.156 |
from transformers import pipeline
classifier = pipeline("text-classification", model="YOUR_USERNAME/distilbert-emotion-classifier")
result = classifier("I am so happy today!")
print(result)
# [{'label': 'joy', 'score': 0.999}]
Or load the model directly:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/distilbert-emotion-classifier")
model = AutoModelForSequenceClassification.from_pretrained("YOUR_USERNAME/distilbert-emotion-classifier")
If you use this model, please cite the original emotion dataset:
@inproceedings{saravia-etal-2018-carer,
title = "{CARER}: Contextualized Affect Representations for Emotion Recognition",
author = "Saravia, Elvis and Liu, Hsien-Chi Toby and Huang, Yen-Hao and Wu, Junlin and Chen, Yi-Shin",
booktitle = "Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing",
year = "2018",
publisher = "Association for Computational Linguistics",
}