Instructions to use fremy7/xlm_roberta_emotion_detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fremy7/xlm_roberta_emotion_detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="fremy7/xlm_roberta_emotion_detector")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("fremy7/xlm_roberta_emotion_detector") model = AutoModelForSequenceClassification.from_pretrained("fremy7/xlm_roberta_emotion_detector", device_map="auto") - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
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]
- Downloads last month
- 5