File size: 1,029 Bytes
d282e26
 
 
 
b179afb
d282e26
b179afb
1a3f5e6
b179afb
 
 
 
1a3f5e6
b179afb
1a3f5e6
d282e26
b179afb
 
1a3f5e6
b179afb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
language:
- vi
base_model:
- VietAI/vit5-base
---
A model fine-tuned for sentiment analysis based on [VietAI/vit5-base](https://huggingface.co/vinai/phobert-base).

Labels:
- NEG: Negative
- POS: Positive
- NEU: Neutral

Dataset: Comments on Shoppe (https://shopee.vn/)
## Usage
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("lamsytan/sentiment-analysis-base-phobert")
model = AutoModelForSequenceClassification.from_pretrained("lamsytan/sentiment-analysis-base-phobert")

sentence = "Áo đẹp lắm nhá lần sau sẽ ghé tiếp ạ"

inputs = tokenizer(sentence, return_tensors="pt", padding=True, truncation=True)

with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits
    probabilities = torch.softmax(logits, dim=-1)

print(probabilities.tolist())
    # Output:
    # [[0.010827462188899517, 0.9538241624832153, 0.035348404198884964]]
    #         ^                         ^                  ^