lamsytan commited on
Commit
624fe24
·
verified ·
1 Parent(s): 78e6ff6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
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-product-comment-phobert-base")
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
+ # ^ ^ ^