Instructions to use tsdocode/phobert-finetune-hatespeech with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tsdocode/phobert-finetune-hatespeech with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="tsdocode/phobert-finetune-hatespeech")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("tsdocode/phobert-finetune-hatespeech") model = AutoModelForSequenceClassification.from_pretrained("tsdocode/phobert-finetune-hatespeech") - Notebooks
- Google Colab
- Kaggle
PhoBert
Dataset
- VLSP2019: Hate Speech Detection on Social Networks Dataset
- ViHSD: Vietnamese Hate Speech Detection dataset
Class name
- LABEL_0 : Normal
- LABEL_1 : OFFENSIVE
- LABEL_2 : HATE
Usage example with TextClassificationPipeline
from transformers import AutoModelForSequenceClassification, AutoTokenizer, TextClassificationPipeline
model = AutoModelForSequenceClassification.from_pretrained("tsdocode/phobert-finetune-hatespeech", num_labels=3)
tokenizer = AutoTokenizer.from_pretrained("tsdocode/phobert-finetune-hatespeech")
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True)
# outputs a list of dicts like [[{'label': 'NEGATIVE', 'score': 0.0001223755971295759}, {'label': 'POSITIVE', 'score': 0.9998776316642761}]]
pipe("đồ ngu")
- Downloads last month
- 9