lamsytan's picture
Create README.md
1a3f5e6 verified
|
raw
history blame
961 Bytes

A model fine-tuned for sentiment analysis based on vinai/phobert-base.

Labels:

  • NEG: Negative
  • POS: Positive
  • NEU: Neutral

Dataset: Comments on Shoppe (https://shopee.vn/)

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch

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]] # ^ ^ ^ # NEG POS NEU