Downloads · 30 days
12
2% of all-time downloads
huynguyen251/phobert-legal-qa-v2
phobert-legal-qa-v2 is a question answering model from huynguyen251. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of vinai/phobert-base for Vietnamese legal question answering.
Downloads · 30 days
12
2% of all-time downloads
All-time downloads
579
Public
Parameters
134M
4.8 GB on disk
Likes
3
Public
Click a slice to open those files.
.pt3.2 GB · 60%
From the Hugging Face model README
This model is a fine-tuned version of vinai/phobert-base for Vietnamese legal question answering.
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
import torch
tokenizer = AutoTokenizer.from_pretrained("huynguyen251/phobert-legal-qa-v2")
model = AutoModelForQuestionAnswering.from_pretrained("huynguyen251/phobert-legal-qa-v2")
question = "Quy định này áp dụng cho ai?"
context = "Thanh niên là công dân Việt Nam từ đủ 16 tuổi đến 30 tuổi."
inputs = tokenizer(question, context, return_tensors="pt", max_length=512, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
start_idx = torch.argmax(outputs.start_logits)
end_idx = torch.argmax(outputs.end_logits)
answer = tokenizer.decode(inputs["input_ids"][0][start_idx:end_idx+1])
print(f"Answer: {answer}")
This model is trained on Vietnamese legal documents and may not generalize to other domains or languages.