facebook/empathetic_dialogues
Updated • 4.48k • 131
How to use Sidharthan/roberta-base-conv-emotion with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Sidharthan/roberta-base-conv-emotion") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Sidharthan/roberta-base-conv-emotion")
model = AutoModelForSequenceClassification.from_pretrained("Sidharthan/roberta-base-conv-emotion")This is a RoBERTa-based model fine-tuned on the Empathetic Dialogues dataset for conversational emotion classification. The model leverages the powerful RoBERTa architecture to understand and classify emotional contexts in conversational text.
The model is trained to classify conversations into the following emotional categories:
| Metric | Score |
|---|---|
| Test Loss | 0.8107 |
| Test Accuracy | 73.01% |
| Test F1 Score | 72.96% |
| Runtime | 10.99 seconds |
| Samples per Second | 61.68 |
| Steps per Second | 1.001 |
from transformers import pipeline
# Initialize the emotion classification pipeline
classifier = pipeline(
"text-classification",
model="Sidharthan/roberta-base-conv-emotion"
)
# Classify emotion in a conversation
text = "I'm feeling really frustrated with work lately."
result = classifier(text)
print(result)
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# Load the model and tokenizer
model_name = "Sidharthan/roberta-base-conv-emotion"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Prepare input
text = "I'm feeling really frustrated with work lately."
inputs = tokenizer(text, return_tensors="pt")
# Predict
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.softmax(outputs.logits, dim=1)
predicted_class = torch.argmax(predictions, dim=1)
Apache 2.0
@misc{roberta-base-conv-emotion,
title={RoBERTa Fine-Tuned on Empathetic Dialogues},
author={Sidharthan},
year={2024},
publisher={Hugging Face}
}
For more information, please contact the model's author.
Base model
FacebookAI/roberta-base