dair-ai/emotion
Viewer • Updated • 437k • 33.7k • 440
How to use AnkitAI/deberta-xlarge-base-emotions-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="AnkitAI/deberta-xlarge-base-emotions-classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("AnkitAI/deberta-xlarge-base-emotions-classifier")
model = AutoModelForSequenceClassification.from_pretrained("AnkitAI/deberta-xlarge-base-emotions-classifier")This is a fine-tuned version of microsoft/deberta-xlarge-mnli for emotion detection on the dair-ai/emotion dataset.
Emotion-X is a state-of-the-art emotion detection model fine-tuned from Microsoft's DeBERTa-Xlarge model. Designed to accurately classify text into one of six emotional categories, Emotion-X leverages the robust capabilities of DeBERTa and fine-tunes it on a comprehensive emotion dataset, ensuring high accuracy and reliability.
AnkitAI/deberta-xlarge-base-emotions-classifiermicrosoft/deberta-xlarge-mnliThe model was trained using the following parameters:
You can use this model directly with the Hugging Face transformers library:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_name = "AnkitAI/deberta-xlarge-base-emotions-classifier"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Example usage
def predict_emotion(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
outputs = model(**inputs)
logits = outputs.logits
predictions = logits.argmax(dim=1)
return predictions
text = "I'm so happy with the results!"
emotion = predict_emotion(text)
print("Detected Emotion:", emotion)
| Parameter | Value |
|---|---|
| Model Name | microsoft/deberta-xlarge-mnli |
| Training Dataset | dair-ai/emotion |
| Learning Rate | 2e-5 |
| Per Device Train Batch Size | 4 |
| Evaluation Strategy | Epoch |
| Best Model Accuracy | 94.6% |
This model is licensed under the MIT License.