Views
No views yet
| 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 |
1from transformers import pipeline
2
3# Initialize the emotion classification pipeline
4classifier = pipeline(
5 "text-classification",
6 model="Sidharthan/roberta-base-conv-emotion"
7)
8
9# Classify emotion in a conversation
10text = "I'm feeling really frustrated with work lately."
11result = classifier(text)
12print(result)1from transformers import AutoModelForSequenceClassification, AutoTokenizer
2import torch
3
4# Load the model and tokenizer
5model_name = "Sidharthan/roberta-base-conv-emotion"
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8
9# Prepare input
10text = "I'm feeling really frustrated with work lately."
11inputs = tokenizer(text, return_tensors="pt")
12
13# Predict
14with torch.no_grad():
15 outputs = model(**inputs)
16 predictions = torch.softmax(outputs.logits, dim=1)
17 predicted_class = torch.argmax(predictions, dim=1)1@misc{roberta-base-conv-emotion,
2 title={RoBERTa Fine-Tuned on Empathetic Dialogues},
3 author={Sidharthan},
4 year={2024},
5 publisher={Hugging Face}
6}