Downloads · 30 days
6
2% of all-time downloads
fremy7/xlm_roberta_emotion_detector
xlm_roberta_emotion_detector is a text classification model from fremy7. Use it when you need a label for a piece of text. It is set up for transformers.
This model was fine-tuned using GO Emotions dataset (https://huggingface.co/datasets/google-research-datasets/goemotions).
Downloads · 30 days
6
2% of all-time downloads
All-time downloads
269
Public
Parameters
278M
3.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt2.2 GB · 66%
From the Hugging Face model README
This model was fine-tuned using GO Emotions dataset (https://huggingface.co/datasets/google-research-datasets/go_emotions).
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
tokenizer = AutoTokenizer.from_pretrained("fremy7/xlm_roberta_emotion_detector")
model = AutoModelForSequenceClassification.from_pretrained("fremy7/xlm_roberta_emotion_detector")
model.to('cuda:0')
text_input = 'Jsem velmi nešťastný.'
inputs = tokenizer(text_input, return_tensors="pt").to('cuda:0')
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
detected_label = model.config.id2label[predicted_class_id]