File size: 709 Bytes
c25d5b1
 
32c4795
 
a350177
 
c25d5b1
 
 
 
 
 
 
 
 
 
 
4a34074
32c4795
4a34074
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
This model was fine-tuned using GO Emotions dataset (https://huggingface.co/datasets/google-research-datasets/go_emotions). 

# Usage:
```python 
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]
```