roberta-large-emopillars-contextless-isear

This model is a fine-tuned version of roberta-large-emopillars-contextless on the ISEAR dataset. The base model was trained on EmoPillars' context-less subset.

Model description

The model is a multi-label classifier over 28 emotional classes for a context-less scenario, fine-tuned on a dataset of 7 classes (anger, disgust, fear, sadness, joy, shame, guilt). It detects emotions in the entire input (including context if provided).

How to use

Here is how to use this model:

>>> import torch
>>> from transformers import pipeline
>>> model_name = "roberta-large-emopillars-contextless-isear"
>>> threshold = 0.5
>>> emotions = [
>>>     "admiration", "amusement", "anger", "annoyance", "approval", "caring", "confusion",
>>>     "curiosity", "desire", "disappointment", "disapproval", "disgust", "embarrassment",
>>>     "excitement", "fear", "gratitude", "grief", "joy", "love", "nervousness", "optimism",
>>>     "pride", "realization", "relief", "remorse", "sadness", "surprise", "neutral"
>>> ]
>>> label_to_emotion = dict(zip(list(range(len(emotions))), emotions))
>>> emotion_to_isear = {
>>>     "anger": "anger",
>>>     "disgust": "disgust",
>>>     "fear": "fear",
>>>     "sadness": "sadness",
>>>     "joy": "joy",
>>>     "embarrassment": "shame",
>>>     "remorse": "guilt"
>>> }
>>> device = torch.device("cuda" if torch.cuda.is_available() else "CPU")
>>> pipe = pipeline("text-classification", model=model_name, truncation=True,
>>>                  return_all_scores=True, device=-1 if device.type=="cpu" else 0)
>>> # input in a format f"{text}"
>>> utterances = [
>>>     "Ok is it just me or is anyone else getting goosebumps too???",
>>>     "Don’t know what to do",
>>>     "When a car is overtaking another and I am forced to drive off the road."
>>> ]
>>> outcome = pipe(utterances)
>>> dominant_classes = [
>>>     [prediction for prediction in example if prediction['score'] >= threshold and 
>>>      label_to_emotion[int(prediction['label'])] in emotion_to_isear]
>>>     for example in outcome
>>> ]
>>> for example in dominant_classes:
>>>     print(", ".join([
>>>         "%s: %.2lf" % (emotion_to_isear[label_to_emotion[int(prediction['label'])]], prediction['score']) 
>>>         for prediction in sorted(example, key=lambda x: x['score'], reverse=True)
>>>     ]))
fear: 0.90
sadness: 0.91
anger: 1.00

Training data

The training data consists of 6013 samples of the ISEAR dataset.

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-05
  • train_batch_size: 4
  • eval_batch_size: 8
  • seed: 752
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 8.0

Framework versions

  • Transformers 4.45.0.dev0
  • Pytorch 2.4.0a0+gite3b9b71
  • Datasets 2.21.0
  • Tokenizers 0.19.1

Evaluation

Scores for the evaluation on the test split (20% of the ISEAR dataset):

class precision recall f1-score support
anger 0.67 0.65 0.66 209
disgust 0.75 0.72 0.74 232
fear 0.88 0.81 0.84 205
sadness 0.71 0.78 0.74 198
joy 0.93 0.93 0.93 219
shame 0.64 0.66 0.65 222
guilt 0.75 0.72 0.73 218
micro avg 0.76 0.75 0.76 1503
macro avg 0.76 0.75 0.76 1503
weighted avg 0.76 0.75 0.76 1503
samples avg 0.75 0.75 0.75 1503

For more details on the evaluation, please visit our GitHub repository or paper.

Citation information

If you use this model, please cite our paper:

@misc{shvets2025emopillarsknowledgedistillation,
      title={Emo Pillars: Knowledge Distillation to Support Fine-Grained Context-Aware and Context-Less Emotion Classification}, 
      author={Alexander Shvets},
      year={2025},
      eprint={2504.16856},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2504.16856}
}

Disclaimer

Click to expand

The model published in this repository is intended for a generalist purpose and is available to third parties. This model may have bias and/or any other undesirable distortions.

When third parties deploy or provide systems and/or services to other parties using this model (or using systems based on this model) or become users of the model, they should note that it is their responsibility to mitigate the risks arising from its use and, in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence.

In no event shall the creator of the model be liable for any results arising from the use made by third parties of this model.

Downloads last month
0
Safetensors
Model size
355M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 2 Ask for provider support

Collection including alex-shvets/roberta-large-emopillars-contextless-isear