Downloads · 30 days
8
24% of all-time downloads
BaoNhan/bn-newsbert-ViHSD
bn-newsbert-ViHSD is a text classification model from BaoNhan. Use it when you need a label for a piece of text. It is set up for transformers.
This model is BaoNhan/BN-NewsBERT fine-tuned for ViHSD hate speech detection on ViHSD.
Downloads · 30 days
8
24% of all-time downloads
All-time downloads
33
Public
Parameters
560M
2.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 100%
From the Hugging Face model README
This model is BaoNhan/BN-NewsBERT fine-tuned for ViHSD hate speech detection on ViHSD.
Metrics are reported as mean ± sample standard deviation over the available completed seeds.
| Metric | Mean ± std |
|---|---|
| Test Macro-F1 | 0.5909 ± 0.0370 |
| Test accuracy | 0.8699 ± 0.0015 |
| Test macro precision | 0.6603 ± 0.0074 |
| Test macro recall | 0.5740 ± 0.0416 |
| Development Macro-F1 | 0.5923 ± 0.0489 |
| seed | dev_macro_f1 | test_macro_f1 | test_accuracy |
|---|---|---|---|
| 22.000000 | 0.555701 | 0.560737 | 0.870509 |
| 42.000000 | 0.573480 | 0.579729 | 0.868114 |
| 202.000000 | 0.647849 | 0.632238 | 0.870958 |
{
"0": "CLEAN",
"1": "OFFENSIVE",
"2": "HATE"
}
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_id = "BaoNhan/bn-newsbert-ViHSD"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
# PhoBERT-style checkpoint: segment raw Vietnamese with VnCoreNLP first.
text = "Đây là văn_bản tiếng_Việt đã được chuẩn_hóa ."
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=256,
)
with torch.no_grad():
probabilities = model(**inputs).logits.softmax(dim=-1)[0]
predicted_id = int(probabilities.argmax())
print(model.config.id2label[predicted_id], probabilities.tolist())
ViHSD is class-imbalanced and reflects Vietnamese social-media language from a particular collection period. Performance may not transfer directly to new platforms, dialects, code-switching patterns, irony, or emerging slang. Predictions should not be the sole basis for moderation or punitive decisions.
@InProceedings{10.1007/978-3-030-79457-6_35,
author={Luu, Son T. and Nguyen, Kiet Van and Nguyen, Ngan Luu-Thuy},
title={A Large-Scale Dataset for Hate Speech Detection on Vietnamese Social Media Texts},
booktitle={Advances and Trends in Artificial Intelligence. Artificial Intelligence Practices},
year={2021},
publisher={Springer International Publishing},
pages={415--426},
doi={10.1007/978-3-030-79457-6_35}
}