Downloads · 30 days
19
17% of all-time downloads
vipont/beto-sentiment-spanish
beto-sentiment-spanish is a text classification model from vipont. Use it when you need a label for a piece of text. The card lists the license as mit.
BERT-based sentiment analysis for Spanish text, fine-tuned on 50,000 IMDB movie reviews translated to Spanish.
Downloads · 30 days
19
17% of all-time downloads
All-time downloads
113
Public
Parameters
110M
439 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors439 MB · 100%
From the Hugging Face model README
BERT-based sentiment analysis for Spanish text, fine-tuned on 50,000 IMDB movie reviews translated to Spanish.
from transformers import BertTokenizer, BertForSequenceClassification
import torch
import torch.nn.functional as F
tokenizer = BertTokenizer.from_pretrained('vipont/beto-sentiment-spanish')
model = BertForSequenceClassification.from_pretrained('vipont/beto-sentiment-spanish')
model.eval()
def predict(text):
inputs = tokenizer(text, return_tensors='pt', truncation=True, padding=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = F.softmax(outputs.logits, dim=-1)
pred = torch.argmax(probs).item()
return 'positive' if pred == 1 else 'negative', round(probs[0][pred].item() * 100, 2)
print(predict("Me encantó la película, fue increíble"))
print(predict("Terrible, una pérdida de tiempo"))
| Metric | Score |
|---|---|
| Accuracy | 88% |
| F1 (positive) | 0.88 |
| F1 (negative) | 0.87 |