Downloads · 30 days
5
5% of all-time downloads
Yenreh/xlm-roberta-large-tass-sentiment-bs16
xlm-roberta-large-tass-sentiment-bs16 is a machine learning model from Yenreh. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a fine-tuned version of FacebookAI/xlm-roberta-large for sentiment analysis on Spanish Twitter data (TASS dataset).
Downloads · 30 days
5
5% of all-time downloads
All-time downloads
93
Public
Parameters
560M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 99%
From the Hugging Face model README
This model is a fine-tuned version of FacebookAI/xlm-roberta-large for sentiment analysis on Spanish Twitter data (TASS dataset).
| Metric | Score |
|---|---|
| F1 Score | 0.6899 |
| Accuracy | 0.6901 |
| Precision | 0.6904 |
| Recall | 0.6901 |
Metrics per epoch during training:
| Epoch | Loss | Accuracy | F1 Score | Precision | Recall |
|---|---|---|---|---|---|
| 1 | 0.8022 | 0.6908 | 0.6796 | 0.6845 | 0.6908 |
| 2 | 0.7347 | 0.6853 | 0.6846 | 0.6850 | 0.6853 |
| 3 | 0.7679 | 0.6736 | 0.6671 | 0.6677 | 0.6736 |
| 4 | 0.8447 | 0.6901 | 0.6899 | 0.6904 | 0.6901 |
| 5 | 0.9078 | 0.6950 | 0.6863 | 0.6879 | 0.6950 |
| 6 | 1.2134 | 0.6846 | 0.6829 | 0.6826 | 0.6846 |
| 7 | 1.4088 | 0.6846 | 0.6833 | 0.6831 | 0.6846 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Cargar modelo y tokenizer
tokenizer = AutoTokenizer.from_pretrained("tu-usuario/xlm-roberta-large-tass-sentiment-bs16")
model = AutoModelForSequenceClassification.from_pretrained("tu-usuario/xlm-roberta-large-tass-sentiment-bs16")
# Ejemplo de uso
text = "Me encanta este producto, es excelente"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
labels = {0: "Negativo", 1: "Neutral", 2: "Positivo"}
print(f"Sentimiento: {labels[predicted_class]}")
print(f"Confianza: {predictions[0][predicted_class].item():.4f}")
from transformers import pipeline
# Usar como pipeline
classifier = pipeline('sentiment-analysis', model='tu-usuario/xlm-roberta-large-tass-sentiment-bs16')
result = classifier("Me encanta este producto, es excelente")
print(result)
# Output: [{'label': 'LABEL_2', 'score': 0.95}]
# LABEL_0 = Negativo, LABEL_1 = Neutral, LABEL_2 = Positivo
0 (LABEL_0): Negative sentiment1 (LABEL_1): Neutral sentiment2 (LABEL_2): Positive sentimentThe model was trained with weighted loss to handle class imbalance.
Distribution in training set (estimated):