Downloads · 30 days
17
13% of all-time downloads
Hidden-States/roberta-base-emopillars-contextless
roberta-base-emopillars-contextless is a text classification model from Hidden-States. 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 finetuned and optimized for fine-grained multi-label emotion classification task from text. The model employs a hybrid training objective that integrates similarity-based contrastive learning with a clas…
Downloads · 30 days
17
13% of all-time downloads
All-time downloads
134
Public
Parameters
124M
498 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors498 MB · 99%
From the Hugging Face model README
This model is finetuned and optimized for fine-grained multi-label emotion classification task from text. The model employs a hybrid training objective that integrates similarity-based contrastive learning with a classification objective, instead of using the conventional binary cross-entropy (BCE) loss alone. This approach enables the model to capture both semantic alignment between text and emotion concepts and label-specific decision boundaries, resulting in improved performance on the EmoPillars dataset.
This model is the Model II (Classifier-based) variant accounding in our paper, which has achieved the best performance. Please read your work for more details of the model architecture and training objectives used.
The model is specifically intended for fine-grained multi-label emotion classification from text in both practical and research settings. It can be used to detect emotions from short to medium-length textual content such as social media posts, user comments, online discussions, reviews, and conversational text, where identifying fine-grained emotion categories give better insights.
The model is suitable for local and offline deployment for tasks such as emotion-aware text analysis, affective computing research, and downstream NLP applications that benefit from fine-grained emotion signals.
EmoPillars(2025): A large-scale multi-label emotion classification dataset, consisting of 300K English synthetic comments, annotated with 27 emotion categories plus a neutral label. The dataset is diverse and representative of real-world emotional language, consisting of informal grammar, sarcasm, and ambiguous or context-dependent cues. In this work, we adopt the full 28-label GoEmotions taxonomy for training & used a preprocessed subset of 100K examples.
The model is evaluated using standard multi-label metrics, with a focus on Macro-F1, which is widely regarded as the most informative metric for such imbalanced, multi-label emotion classification tasks.
| Traning Objective | Macro-F1 |
|---|---|
| Binary Cross-Entropy (BCE) loss | 0.67 |
| Clipped Asymmetic Loss (CAL) | 0.69 |
| Our proposed Hybrid Objective | 0.70 |
🏆 Given the absence of existing competitive base model varients on this EmoPillars dataset, our model is currently <u>state-of-the-art</u> among open-source methods! 🥇
import torch
from transformers import AutoTokenizer, AutoModel
from transformers import logging as transformers_logging
import warnings
warnings.filterwarnings("ignore")
transformers_logging.set_verbosity_error()
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_id = "Hidden-States/roberta-base-emopillars-contextless"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id, trust_remote_code=True)
model.to(device).eval()
emotion_labels = [
"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"
]
def predict_emotions(text):
inputs = tokenizer(text, truncation=True, max_length=128,
padding=True, return_attention_mask=True, return_tensors="pt"
).to(device)
_, logits = model(**inputs)
probs = torch.sigmoid(logits)
preds = (probs >= 0.5).int()[0]
predicted_emotions = [
emotion_labels[i]
for i, v in enumerate(preds)
if v.item() == 1
]
print(predicted_emotions)
text = "Honestly, same. I was miserable at my admin asst job."
predict_emotions(text)
#output: ['annoyance', 'disappointment', 'sadness']
| Parameter | Value |
|---|---|
| encoder lr-rate | 2.5e-5 |
| classifier lr-rate | 1.5e-4 |
| optimizer | AdamW |
| lr-scheduler | cosine with warmup |
| weight decay | 0.001 |
| warmup ratio | 0.1 |
| temperature | 0.05 |
| clipping constant | 0.05 |
| batch size | 64 |
| epochs | 8 |
| threshold | 0.5 (fixed) |
Check out our paper for complete training details and objectives used: Visit ↗️
Inference: Any modern x86 CPU with minimum 8 GB RAM. GPU is optional, not required for inference.
Training/ Fine-Tuning: Must use GPU with at least 12 GB of VRAM. This model has been trained in Google Colab environment with single T4 GPU.
Libraries/ Modules
The model cannot be directly used for detecting emotions from multi-lingual or multi-modal data/text, and cannot predict emotions beyond the 28-label GoEmotions-taxonomy. While the proposed approach demonstrates strong empirical performance on benchmark datasets, it is not designed, evaluated, or validated for deployment in high-stakes or safety-critical applications. The model may reflect dataset-specific biases, annotation subjectivity, and cultural limitations inherent in emotion datasets. Predictions should therefore be interpreted as approximate signals rather than definitive emotional states.
Users are responsible for ensuring that any downstream application complies with relevant ethical guidelines, legal regulations, and domain-specific standards. <br>
If you find this model useful, please consider liking this repository and also give a star to our GitHub repository. Your support helps us improve and maintain this work! ⭐
📝 If you use our work in academic or research settings, please cite our work accordingly. 🙏😃 <br> <br>
THANK YOU!! 🧡🤍💚<br> - with regards: Hidden States AI Labs