Update README.md
Browse files
README.md
CHANGED
@@ -2,18 +2,34 @@
|
|
2 |
language:
|
3 |
- vi
|
4 |
base_model:
|
5 |
-
-
|
6 |
---
|
7 |
-
A model fine-tuned for sentiment analysis based on [
|
8 |
|
9 |
-
|
|
|
|
|
|
|
10 |
|
|
|
11 |
## Usage
|
12 |
```python
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
language:
|
3 |
- vi
|
4 |
base_model:
|
5 |
+
- VietAI/vit5-base
|
6 |
---
|
7 |
+
A model fine-tuned for sentiment analysis based on [VietAI/vit5-base](https://huggingface.co/vinai/phobert-base).
|
8 |
|
9 |
+
Labels:
|
10 |
+
- NEG: Negative
|
11 |
+
- POS: Positive
|
12 |
+
- NEU: Neutral
|
13 |
|
14 |
+
Dataset: Comments on Shoppe (https://shopee.vn/)
|
15 |
## Usage
|
16 |
```python
|
17 |
+
import torch
|
18 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
19 |
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained("lamsytan/sentiment-analysis-base-phobert")
|
21 |
+
model = AutoModelForSequenceClassification.from_pretrained("lamsytan/sentiment-analysis-base-phobert")
|
22 |
+
|
23 |
+
sentence = "Áo đẹp lắm nhá lần sau sẽ ghé tiếp ạ"
|
24 |
+
|
25 |
+
inputs = tokenizer(sentence, return_tensors="pt", padding=True, truncation=True)
|
26 |
+
|
27 |
+
with torch.no_grad():
|
28 |
+
outputs = model(**inputs)
|
29 |
+
logits = outputs.logits
|
30 |
+
probabilities = torch.softmax(logits, dim=-1)
|
31 |
+
|
32 |
+
print(probabilities.tolist())
|
33 |
+
# Output:
|
34 |
+
# [[0.010827462188899517, 0.9538241624832153, 0.035348404198884964]]
|
35 |
+
# ^ ^ ^
|