Downloads · 30 days
17
1% of all-time downloads
gbarone77/polibert_sa
polibert_sa is a text classification model from gbarone77. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
This model performs sentiment analysis on Italian political twitter sentences. It was trained starting from an instance of "bert-base-italian-uncased-xxl" and fine-tuned on an Italian dataset of tweets. You can try it…
Downloads · 30 days
17
1% of all-time downloads
All-time downloads
2K
Public
Repo size
1.8 GB
Likes
0
Public
Click a slice to open those files.
.h5443 MB · 33%
From the Hugging Face model README
This model performs sentiment analysis on Italian political twitter sentences. It was trained starting from an instance of "bert-base-italian-uncased-xxl" and fine-tuned on an Italian dataset of tweets. You can try it out at https://www.unideeplearning.com/twitter_sa/ (in italian!)
import torch
from torch import nn
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("unideeplearning/polibert_sa")
model = AutoModelForSequenceClassification.from_pretrained("unideeplearning/polibert_sa")
text = "Giuseppe Rossi è un pessimo politico"
input_ids = tokenizer.encode(text, add_special_tokens=True, return_tensors= 'pt')
logits, = model(input_ids)
logits = logits.squeeze(0)
prob = nn.functional.softmax(logits, dim=0)
# 0 Negative, 1 Neutral, 2 Positive
print(prob.argmax().tolist())
Thanks to the support from: the Hugging Face, https://www.unioneprofessionisti.com