Back to all models
text-classification mask_token: [MASK]
Query this model
🔥 This model is currently loaded and running on the Inference API. ⚠️ This model could not be loaded by the inference API. ⚠️ This model can be loaded on the Inference API on-demand.
JSON Output
API endpoint
								curl -X POST \
-H "Authorization: Bearer YOUR_ORG_OR_USER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '"json encoded string"' \
Share Copied link to clipboard

Monthly model downloads

unideeplearning/polibert_sa unideeplearning/polibert_sa
last 30 days



Contributed by

unideeplearning Gianfranco Barone
1 model

How to use this model directly from the 🤗/transformers library:

Copy to clipboard
from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("unideeplearning/polibert_sa") model = AutoModelForSequenceClassification.from_pretrained("unideeplearning/polibert_sa")

🤗 + polibert_SA - POLItic BERT based Sentiment Analysis

Model description

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.


import torch
from torch import nn 

text = "Giueseppe 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 


  • Optimizer: AdamW with learning rate of 2e-5, epsilon of 1e-8
  • Max epochs: 2
  • Batch size: 16


Thanks to the support from: the Hugging Face, Unione Professionisti (