💡 This model is part of the collection Frontier BERT Workhorses.

banner

Overview

This model was fine-tuned from ModernBERT-base on the Super Emotion dataset for multi-class emotion classification. It predicts emotional states in text across seven labels: joy, sadness, anger, fear, love, neutral, surprise.


Model Details

  • Base Model: ModernBERT-base
  • Fine-Tuning Dataset: Super Emotion
  • Number of Labels: 7
  • Problem Type: Multi-label classification
  • Language: English
  • License: CC-BY-4.0
  • Fine-Tuning Framework: Hugging Face Transformers

Example Usage

Here’s how to use the model with Hugging Face Transformers:

from transformers import pipeline

# Load the model
classifier = pipeline(
    "text-classification", 
    model="cirimus/modernbert-base-emotions",
    top_k=5
)

text = "I can't believe this just happened!"
predictions = classifier(text)

# Print top 3 detected emotions
sorted_preds = sorted(predictions[0], key=lambda x: x['score'], reverse=True)
top_3 = sorted_preds[:3]

print("\nTop 3 emotions detected:")
for pred in top_3:
    print(f"\t{pred['label']:10s} : {pred['score']:.3f}")

# Example output:
# Top 3 emotions detected:
#        SURPRISE   : 0.843
#        FEAR       : 0.059
#        NEUTRAL    : 0.049

How the Model Was Created

The model was fine-tuned for 2 epochs using the following hyperparameters:

  • Learning Rate: 2e-5
  • Batch Size: 16
  • Weight Decay: 0.01
  • Warmup Steps: Cosine decay scheduling
  • Optimizer: AdamW
  • Evaluation Metrics: Precision, Recall, F1 Score (macro), Accuracy

Evaluation Results

As evaluated on the joint test-set:

Accuracy Precision Recall F1 MCC Support
macro avg 0.967 0.879 0.802 0.836 0.818 51950
NEUTRAL 0.946 0.609 0.702 0.652 0.625 3734
SURPRISE 0.981 0.863 0.630 0.729 0.729 2064
FEAR 0.975 0.936 0.822 0.875 0.864 5526
SADNESS 0.968 0.988 0.888 0.936 0.916 13792
JOY 0.961 0.962 0.915 0.938 0.910 16623
ANGER 0.966 0.921 0.853 0.885 0.866 7993
LOVE 0.969 0.871 0.801 0.835 0.818 5071

Confusion Matrix


Intended Use

The model is designed for emotion classification in English-language text, particularly useful for:

  • Social media sentiment analysis
  • Customer feedback evaluation
  • Large scale behavioral or psychological research

The model is designed for fast and accurate emotion detection but struggles with subtle expressions or indirect references to emotions (e.g., "I find myself remembering the little things you say, long after you've said them.")


Limitations and Biases

  • Data Bias: The dataset is aggregated from multiple sources and may contain biases in annotation and class distribution.
  • Underrepresented Classes: Some emotions have fewer samples, affecting their classification performance.
  • Context Dependence: The model classifies individual sentences and may not perform well on multi-sentence contexts.

Environmental Impact

  • Hardware Used: NVIDIA DGX Spark (GB10)
  • Training Time: ~5 hours
  • Carbon Emissions: ~0.28 kg CO2 (estimated via ML CO2 Impact Calculator)

Citation

If you use this model, please cite:

@misc{junque2025emotion,
  title        = {Emotion and Bias Classification with Modern Encoders},
  author       = {Junqu\'e de Fortuny, Enric},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/spaces/cirimus/emotion-detection}}
}
Downloads last month
665
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for cirimus/modernbert-base-emotions

Finetuned
(1560)
this model

Dataset used to train cirimus/modernbert-base-emotions

Space using cirimus/modernbert-base-emotions 1

Collection including cirimus/modernbert-base-emotions