CoolFace
Modelpublic

cirimus/modernbert-large-go-emotions

sourceHugging Facemitupdated 1y agoView on Hugging Face
9likes9.1kdownloads
Model Card

banner

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:

python
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.003

How 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.

LabelAccuracyPrecisionRecallF1MCCSupportThreshold
macro avg0.9710.6110.4100.4720.47554270.5
admiration0.9460.7390.6530.6930.6665040.5
amusement0.9820.8170.8140.8160.8072640.5
anger0.9680.6710.2370.3510.3871980.5
annoyance0.9380.4490.1910.2680.2653200.5
approval0.9400.5640.3020.3930.3843510.5
caring0.9770.5810.3190.4110.4201350.5
confusion0.9730.5530.3070.3950.4001530.5
curiosity0.9520.5510.4540.4980.4762840.5
desire0.9880.7020.3980.5080.523830.5
disappointment0.9720.5000.1520.2340.2651510.5
disapproval0.9510.5030.3150.3870.3742670.5
disgust0.9810.6850.3010.4180.4461230.5
embarrassment0.9950.8000.3240.4620.507370.5
excitement0.9830.6490.2330.3430.3821030.5
fear0.9910.7380.5770.6470.648780.5
gratitude0.9900.9550.8950.9240.9193520.5
grief0.9990.0000.0000.0000.00060.5
joy0.9800.6580.6460.6520.6421610.5
love0.9830.7950.8150.8050.7962380.5
nervousness0.9960.5560.4350.4880.490230.5
optimism0.9730.7020.3920.5030.5131860.5
pride0.9980.8000.2500.3810.446160.5
realization0.9720.4050.1170.1820.2071450.5
relief0.9980.0000.0000.0000.000110.5
remorse0.9920.5660.8390.6760.686560.5
sadness0.9800.7640.4360.5550.5681560.5
surprise0.9800.6920.4470.5430.5471410.5
neutral0.7960.7160.6280.6690.52517870.5

Optimal Results:

Using the best threshold for each label based on the training set (tuned on F1), tested on the test set:

LabelAccuracyPrecisionRecallF1MCCSupportThreshold
macro avg0.9680.5910.5280.5500.5365427various
admiration0.9470.7220.7020.7120.6835040.40
amusement0.9830.8120.8480.8300.8212640.45
anger0.9660.5480.4600.5000.4851980.25
annoyance0.9260.3780.4030.3900.3513200.30
approval0.9280.4450.4700.4570.4193510.30
caring0.9750.4960.4300.4600.4491350.35
confusion0.9660.4170.5100.4590.4441530.30
curiosity0.9500.5220.5880.5530.5282840.40
desire0.9880.6730.4220.5190.527830.40
disappointment0.9640.3380.3050.3210.3031510.30
disapproval0.9480.4680.4160.4400.4142670.35
disgust0.9780.5290.4470.4850.4751230.25
embarrassment0.9940.6500.3510.4560.475370.35
excitement0.9780.4190.4270.4230.4121030.25
fear0.9900.6620.6280.6450.640780.40
gratitude0.9900.9550.8950.9240.9193520.50
grief0.9990.7500.5000.6000.61260.35
joy0.9800.6600.6400.6500.6391610.50
love0.9820.7740.8360.8040.7952380.45
nervousness0.9950.4350.4350.4350.432230.45
optimism0.9720.5970.5650.5800.5661860.25
pride0.9980.6670.3750.4800.499160.15
realization0.9620.2730.2480.2600.2411450.25
relief0.9990.8000.3640.5000.539110.25
remorse0.9930.6410.7320.6830.681560.65
sadness0.9780.6460.5380.5870.5791560.30
surprise0.9790.6030.5180.5570.5481410.40
neutral0.7910.6690.7220.6950.53717870.40

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:

bibtex
@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}},
}