Downloads · 30 days
9
29% of all-time downloads
Yenreh/xlm-roberta-large-tass-sentiment-bs16-t1
xlm-roberta-large-tass-sentiment-bs16-t1 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
9
29% of all-time downloads
All-time downloads
31
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.4098 |
| Accuracy | 0.5079 |
| Precision | 0.5283 |
| Recall | 0.5079 |
Metrics per epoch during training:
| Epoch | Loss | Accuracy | F1 Score | Precision | Recall |
|---|---|---|---|---|---|
| 1 | 1.1272 | 0.3819 | 0.3235 | 0.4629 | 0.3819 |
| 2 | 1.0278 | 0.4931 | 0.3947 | 0.3591 | 0.4931 |
| 3 | 1.0981 | 0.3991 | 0.2382 | 0.3610 | 0.3991 |
| 4 | 1.0494 | 0.4440 | 0.3561 | 0.3265 | 0.4440 |
| 5 | 1.0650 | 0.4405 | 0.3174 | 0.3696 | 0.4405 |
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):
If you use this model, please cite:
@misc{xlm-roberta-tass-sentiment,
author = {Your Name},
title = {XLM-RoBERTa Large Fine-tuned for Spanish Sentiment Analysis},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/tu-usuario/xlm-roberta-large-tass-sentiment-bs16}}
}