Views
No views yet
| Metric | Score |
|---|---|
| F1 Score | 0.6876 |
| Accuracy | 0.6888 |
| Precision | 0.6874 |
| Recall | 0.6888 |
| Epoch | Loss | Accuracy | F1 Score | Precision | Recall |
|---|---|---|---|---|---|
| 1 | 1.0415 | 0.3796 | 0.2859 | 0.2294 | 0.3796 |
| 2 | 0.8871 | 0.5949 | 0.5811 | 0.6149 | 0.5949 |
| 3 | 0.9549 | 0.5528 | 0.4932 | 0.6216 | 0.5528 |
| 4 | 0.9607 | 0.6059 | 0.5713 | 0.6096 | 0.6059 |
| 5 | 0.9084 | 0.6335 | 0.6301 | 0.6315 | 0.6335 |
| 6 | 0.8614 | 0.6722 | 0.6702 | 0.6696 | 0.6722 |
| 7 | 0.8683 | 0.6798 | 0.6774 | 0.6762 | 0.6798 |
| 8 | 1.1485 | 0.6798 | 0.6786 | 0.6815 | 0.6798 |
| 9 | 1.3851 | 0.6888 | 0.6876 | 0.6874 | 0.6888 |
| 10 | 1.5043 | 0.6770 | 0.6762 | 0.6759 | 0.6770 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Cargar modelo y tokenizer
5tokenizer = AutoTokenizer.from_pretrained("tu-usuario/xlm-roberta-large-tass-sentiment-bs8")
6model = AutoModelForSequenceClassification.from_pretrained("tu-usuario/xlm-roberta-large-tass-sentiment-bs8")
7
8# Ejemplo de uso
9text = "Me encanta este producto, es excelente"
10inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=256)
11
12with torch.no_grad():
13 outputs = model(**inputs)
14 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
15 predicted_class = torch.argmax(predictions, dim=-1).item()
16
17labels = {0: "Negativo", 1: "Neutral", 2: "Positivo"}
18print(f"Sentimiento: {labels[predicted_class]}")
19print(f"Confianza: {predictions[0][predicted_class].item():.4f}")1from transformers import pipeline
2
3# Usar como pipeline
4classifier = pipeline('sentiment-analysis', model='tu-usuario/xlm-roberta-large-tass-sentiment-bs8')
5
6result = classifier("Me encanta este producto, es excelente")
7print(result)
8# Output: [{'label': 'LABEL_2', 'score': 0.95}]
9# LABEL_0 = Negativo, LABEL_1 = Neutral, LABEL_2 = Positivo0 (LABEL_0): Negative sentiment1 (LABEL_1): Neutral sentiment2 (LABEL_2): Positive sentiment