cirimus/modernbert-large-go-emotions

Overview
This model was fine-tuned from ModernBERT-large on the GoEmotions dataset for multi-label classification. It predicts emotional states in text, with a total of 28 possible labels. Each input text can have one or more associated labels, reflecting the multi-label nature of the task.
Try it out here.
Model Details
- Base Model: ModernBERT-large
- Fine-Tuning Dataset: GoEmotions
- Number of Labels: 28
- Problem Type: Multi-label classification
- Language: English
- License: MIT
- Fine-Tuning Framework: Hugging Face Transformers
Example Usage
Here’s how to use the model with Hugging Face Transformers:
from transformers import pipeline
import torch
# Load the model
classifier = pipeline(
"text-classification",
model="cirimus/modernbert-large-go-emotions",
top_k=5
)
text = "I am so happy and excited about this opportunity!"
predictions = classifier(text)
# Print top 5 detected emotions
sorted_preds = sorted(predictions[0], key=lambda x: x['score'], reverse=True)
top_5 = sorted_preds[:5]
print("\nTop 5 emotions detected:")
for pred in top_5:
print(f"\t{pred['label']:10s} : {pred['score']:.3f}")
# Example output:
# Top 5 emotions detected:
# joy : 0.784
# excitement : 0.735
# admiration : 0.013
# gratitude : 0.003
# amusement : 0.003How the Model Was Created
The model was fine-tuned for 3 epochs using the following hyperparameters:
- Learning Rate:
2e-5 - Batch Size: 16
- Weight Decay:
0.01 - Optimizer: AdamW
- Evaluation Metrics: Precision, Recall, F1 Score (weighted), Accuracy
Dataset
The GoEmotions dataset is a multi-label emotion classification dataset derived from Reddit comments. It contains 58,000 examples with 28 emotion labels (e.g., admiration, amusement, anger, etc.), and it is annotated for multi-label classification.
Evaluation Results
The model was evaluated on the test split of the GoEmotions dataset, using a threshold of 0.5 for binarizing predictions. The overall metrics were:
Standard Results:
Using the default threshold of 0.5.
Optimal Results:
Using the best threshold for each label based on the training set (tuned on F1), tested on the test set:
Intended Use
The model is designed for emotion classification in English-language text, particularly in domains such as:
- Social media sentiment analysis
- Customer feedback evaluation
- Behavioral or psychological research
Limitations and Biases
- Data Bias: The dataset is based on Reddit comments, which may not generalize well to other domains or cultural contexts.
- Underrepresented Classes: Certain labels like "grief" and "relief" have very few examples, leading to lower performance for those classes.
- Ambiguity: Some training data contain annotation inconsistencies or ambiguities that may impact predictions.
Environmental Impact
- Hardware Used: NVIDIA RTX4090
- Training Time: <1 hour
- Carbon Emissions: ~0.06 kg CO2 (calculated via ML CO2 Impact Calculator).
Citation
If you use this model, please cite it as follows:
@inproceedings{JdFE2025c,
title = {Emotion Classification with ModernBERT},
author = {Enric Junqu\'e de Fortuny},
year = {2025},
howpublished = {\url{https://huggingface.co/cirimus/modernbert-large-go-emotions}},
}
