Hate Speech Span Detection
Collection
4 items
•
Updated
This model is a fine-tuned version of visobert for Vietnamese Hate Speech Span Detection.
visobert645e-63210050.63640.63580.63730.1230from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
model_name = "visobert-hsd-span"
tok = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)
text = "Ví dụ câu tiếng Việt có nội dung thù ghét ..."
enc = tok(text, return_tensors="pt", truncation=True, max_length=256, is_split_into_words=False)
with torch.no_grad():
logits = model(**enc).logits
pred_ids = logits.argmax(-1)[0].tolist()
# TODO: chuyển pred_ids -> spans theo scheme nhãn của bạn (BIO/BILOU/char-offset)
Apache-2.0