Gemma 4 12B Vietnamese Legal QA QLoRA Adapter
This repository contains a QLoRA adapter fine-tuned from google/gemma-4-12B-it for Vietnamese legal question answering.
Training Data
The dataset contains legal contexts/articles, questions, and reference answers in JSONL format.
Expected schema:
{
"context": "...",
"question": "...",
"answer": "..."
}
Method
- Base model:
google/gemma-4-12B-it - Fine-tuning method: Supervised Fine-Tuning (SFT)
- PEFT method: QLoRA / LoRA adapter
- Max sequence length:
1024 - Epochs:
1 - LoRA rank:
64 - LoRA alpha:
128
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
base_model_id = "google/gemma-4-12B-it"
adapter_id = "loveCiForever/gemma-4-12b-vietnamese-legal-qa-qlora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForMultimodalLM.from_pretrained(
base_model_id,
device_map="auto",
torch_dtype=torch.bfloat16,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
Disclaimer
This model is for research and educational purposes. It should not be used as a substitute for professional legal advice.