Model Card: LawVinaLlama

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:

  • 150,000 Q&A crawled and processed from Thư Viện Pháp Luật (Vietnamese Legal Library)
  • 40,000 Q&A translated and summarized from international law
  • 10,000 Q&A translated and summarized from international law (duplicate, possibly an error)
  • 50,000 Reasoning Q&A generated by GPT-4.0/Gemini

Intended Use Cases:

LawVinaLlama is suitable for the following tasks:

  • Answering legal questions / Providing legal answers based on a given context
  • Summarizing legal content

Limitations:

LawVinaLlama may still encounter some limitations:

  • It may generate misleading or inaccurate information.
  • Its performance depends on the quality of the input data.

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)
Downloads last month
34
Safetensors
Model size
6.86B params
Tensor type
BF16
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for NaverHustQA/LawVinaLlama

Base model

vilm/vinallama-7b
Finetuned
(3)
this model