Downloads · 30 days
27
4% of all-time downloads
NaverHustQA/LawVinaLlama
LawVinaLlama is a text generation model from NaverHustQA. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
27
4% of all-time downloads
All-time downloads
747
Public
Parameters
6.9B
13.7 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors13.7 GB · 100%
From the Hugging Face model README
Model Description:
LawVinaLlama is a large language model (LLM) specialized in Vietnamese law, fine-tuned from the Llama architecture. The model has been trained on real legal documents to improve its ability to reason, retrieve legal information, and summarize legal content.
Main Data Sources:
Intended Use Cases:
LawVinaLlama is suitable for the following tasks:
Limitations:
LawVinaLlama may still encounter some limitations:
How to Use:
Load model
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = 'NaverHustQA/LawVinaLlama',
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
Generate
PROMPT = """
### Hướng dẫn: Bạn là một trợ lí Tiếng Việt. Hãy luôn trả lời một cách trung thực và an toàn
Câu trả lời của bạn không nên chứa bất kỳ nội dung gây hại, nguy hiểm hoặc bất hợp pháp nào
Nếu một câu hỏi không có ý nghĩa hoặc không hợp lý về mặt thông tin, hãy giải thích tại sao thay vì trả lời một điều gì đó không chính xác
Nếu bạn không biết câu trả lời cho một câu hỏi, hãy trẳ lời là bạn không biết và vui lòng không chia sẻ thông tin sai lệch.
### Câu hỏi: {input}
"""
question = """Trình bày về thủ tục li hôn ?"""
text = PROMPT.format_map({
'input': question,
})
input_ids = tokenizer(text, return_tensors='pt', add_special_tokens=False).to('cuda')
generated_ids = model.generate(
input_ids=input_ids['input_ids'],
max_new_tokens=1024,
do_sample=True,
top_p=0.95,
top_k=40,
temperature=0.3,
repetition_penalty=1.1,
no_repeat_ngram_size=7,
num_beams=5,
)
a = tokenizer.batch_decode(generated_ids)[0]
# print(a.split('### Trả lời:')[1])
print(a)
Citation:
Please cite our paper if you find our work helpful:
@article{10.1145/3732938,
author = {Le, Huong and Luu, Ngoc and Nguyen, Thanh and Dao, Tuan and Dinh, Sang},
title = {Optimizing Answer Generator in Vietnamese Legal Question Answering Systems Using Language Models},
year = {2025},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
issn = {2375-4699},
url = {https://doi.org/10.1145/3732938},
doi = {10.1145/3732938},
journal = {ACM Trans. Asian Low-Resour. Lang. Inf. Process.},
}