mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Create README.md (#5989)
This commit is contained in:
parent
33d7506ea1
commit
7e251ae039
44
model_cards/unideeplearning/polibert_sa/README.md
Normal file
44
model_cards/unideeplearning/polibert_sa/README.md
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
language: it
|
||||
tags:
|
||||
- sentiment
|
||||
- Italian
|
||||
license: MIT
|
||||
widget:
|
||||
- text: 'Giuseppe Rossi è un ottimo politico'
|
||||
---
|
||||
|
||||
# 🤗 + 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.
|
||||
|
||||
#### Hands-on
|
||||
|
||||
```python
|
||||
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
|
||||
print(prob.argmax().tolist())
|
||||
```
|
||||
|
||||
#### Hyperparameters
|
||||
|
||||
- Optimizer: **AdamW** with learning rate of **2e-5**, epsilon of **1e-8**
|
||||
- Max epochs: **2**
|
||||
- Batch size: **16**
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
Thanks to the support from:
|
||||
the [Hugging Face](https://huggingface.co/), Unione Professionisti (https://www.unioneprofessionisti.com/)
|
Loading…
Reference in New Issue
Block a user