fremy7's picture
Update README.md
a350177 verified
|
raw
history blame contribute delete
No virus
709 Bytes

This model was fine-tuned using GO Emotions dataset (https://huggingface.co/datasets/google-research-datasets/go_emotions).

Usage:

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]