Instructions to use duyv/wonrax-phobert-base-vietnamese-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use duyv/wonrax-phobert-base-vietnamese-sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="duyv/wonrax-phobert-base-vietnamese-sentiment")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("duyv/wonrax-phobert-base-vietnamese-sentiment") model = AutoModelForSequenceClassification.from_pretrained("duyv/wonrax-phobert-base-vietnamese-sentiment") - Notebooks
- Google Colab
- Kaggle
A model fine-tuned for sentiment analysis based on vinai/phobert-base.
Labels:
- NEG: Negative
- POS: Positive
- NEU: Neutral
Dataset: 30K e-commerce reviews
Usage
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
- Downloads last month
- 5