Downloads · 30 days
10
20% of all-time downloads
Somya26/deberta-emotion-classifier
deberta-emotion-classifier is a text classification model from Somya26. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This model classifies text into 5 emotions: - 😠 Anger - 😨 Fear - 😊 Joy - 😢 Sadness - 😲 Surprise
Downloads · 30 days
10
20% of all-time downloads
All-time downloads
49
Public
Parameters
184M
740 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors738 MB · 99%
From the Hugging Face model README
This model classifies text into 5 emotions:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "Somya26/deberta-emotion-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "I am so happy today!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
probs = torch.sigmoid(outputs.logits).squeeze()
emotions = ['anger', 'fear', 'joy', 'sadness', 'surprise']
for emotion, prob in zip(emotions, probs):
print(f"{emotion}: {prob:.2%}")
Trained on emotion classification dataset using DeBERTa-v3-base.