Downloads · 30 days
50.1K
3% of all-time downloads
wonrax/phobert-base-vietnamese-sentiment
phobert-base-vietnamese-sentiment is a text classification model from wonrax. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
50.1K
3% of all-time downloads
All-time downloads
1.5M
Public
Repo size
1.1 GB
Likes
16
Public
Click a slice to open those files.
.bin540 MB · 100%
From the Hugging Face model README
A model fine-tuned for sentiment analysis based on vinai/phobert-base.
Labels:
Dataset: 30K e-commerce reviews
import torch
from transformers import RobertaForSequenceClassification, AutoTokenizer
model = RobertaForSequenceClassification.from_pretrained("wonrax/phobert-base-vietnamese-sentiment")
tokenizer = AutoTokenizer.from_pretrained("wonrax/phobert-base-vietnamese-sentiment", use_fast=False)
# Just like PhoBERT: INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
sentence = 'Đây là mô_hình rất hay , phù_hợp với điều_kiện và như cầu của nhiều người .'
input_ids = torch.tensor([tokenizer.encode(sentence)])
with torch.no_grad():
out = model(input_ids)
print(out.logits.softmax(dim=-1).tolist())
# Output:
# [[0.002, 0.988, 0.01]]
# ^ ^ ^
# NEG POS NEU