Downloads · 30 days
8
14% of all-time downloads
vominhmanh/qwen3-4b-vihsd-dpo
qwen3-4b-vihsd-dpo is a text generation model from vominhmanh. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
- Model name: Qwen3-4B-ViHSD-DPO - Base model: Qwen3-4B-Instruct - Nhiệm vụ (Task): Vietnamese Hate Speech Detection (Phân loại và phát hiện ngôn từ kích động/thù ghét tiếng Việt). - Điểm đặc biệt: Model được tinh chỉ…
Downloads · 30 days
8
14% of all-time downloads
All-time downloads
56
Public
Parameters
4B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
Model được sử dụng cho tác vụ kiểm duyệt nội dung (Content Moderation) văn bản tiếng Việt. Model không chỉ dự đoán nhãn mà còn cung cấp lời giải thích chi tiết cho kết quả đó.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "vominhmanh/qwen3-4b-vihsd-dpo"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
prompt = "Đồ ngu, có thế mà cũng không biết làm!"
messages = [
{"role": "system", "content": "Bạn là một trợ lý AI chuyên kiểm duyệt nội dung tiếng Việt. Hãy phân loại văn bản sau có chứa ngôn từ thù ghét/độc hại hay không và giải thích chi tiết lý do."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=256
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)