Downloads · 30 days
20
50% of all-time downloads
jihedjabnoun/text-emotion-distilroberta
text-emotion-distilroberta is a text classification model from jihedjabnoun. 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.
This model is a fine-tuned version of distilroberta-base for multi-class emotion classification. It can classify text into 7 emotion categories: Neutral, Happiness, Anger, Sadness, Surprise, Disgust, and Fear.
Downloads · 30 days
20
50% of all-time downloads
All-time downloads
40
Public
Parameters
82.1M
986 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors329 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of distilroberta-base for multi-class emotion classification. It can classify text into 7 emotion categories: Neutral, Happiness, Anger, Sadness, Surprise, Disgust, and Fear.
The model was trained on a comprehensive emotion recognition dataset created by aggregating and preprocessing three publicly available datasets: DailyDialog, ISEAR, and MELD. The final dataset contains 68,301 samples across 7 emotion classes.
The dataset underwent extensive preprocessing to ensure quality and balance:
Original distribution (severely imbalanced):
Balancing strategy:
Applied targeted augmentation techniques to enhance diversity and address minority class underrepresentation:
Techniques used:
Augmentation results:
Total augmented samples: 30,530 (44.69% of final dataset)
Size: 68,301 samples total
Class Distribution:
| Emotion | Count | Percentage |
|---|---|---|
| Neutral | 38,296 | 56.06% |
| Sadness | 5,002 | 7.32% |
| Happiness | 5,001 | 7.32% |
| Disgust | 5,001 | 7.32% |
| Anger | 5,001 | 7.32% |
| Fear | 5,000 | 7.32% |
| Surprise | 5,000 | 7.32% |
Text Statistics:
Dataset Splits:
Splits were created using stratified sampling to maintain proportional class representation across all sets.
| Emotion | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| Anger | 0.5797 | 0.6107 | 0.5948 | 750 |
| Disgust | 0.7923 | 0.7427 | 0.7667 | 750 |
| Fear | 0.8800 | 0.8213 | 0.8497 | 750 |
| Happiness | 0.6383 | 0.5693 | 0.6018 | 750 |
| Neutral | 0.8876 | 0.9020 | 0.8948 | 5745 |
| Sadness | 0.6905 | 0.6565 | 0.6730 | 751 |
| Surprise | 0.6839 | 0.7587 | 0.7193 | 750 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("jihedjabnoun/text-emotion-distilroberta")
model = AutoModelForSequenceClassification.from_pretrained("jihedjabnoun/text-emotion-distilroberta")
# Prepare text
text = "I'm feeling great today!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
# Get prediction
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1)
# Map to label
emotions = {0: 'Anger', 1: 'Disgust', 2: 'Fear', 3: 'Happiness', 4: 'Neutral', 5: 'Sadness', 6: 'Surprise'}
predicted_emotion = emotions[predicted_class.item()]
print(f"Predicted emotion: {predicted_emotion}")
@misc{text-emotion-distilroberta,
title={DistilRoBERTa for Emotion Classification},
author={Jihed Jabnoun},
year={2025},
url={https://huggingface.co/jihedjabnoun/text-emotion-distilroberta}
}