Downloads · 30 days
0
Hedi-Bk/gemma-4b-tunisian-law-lora-2epochs
gemma-4b-tunisian-law-lora-2epochs is a machine learning model from Hedi-Bk. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
LoRA adapters fine-tuned from Gemma 4B for Tunisian law and legal instruction tasks.
Downloads · 30 days
0
Access
Public
Updated Jun 8, 2026
Repo size
195 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 83%
From the Hugging Face model README
LoRA adapters fine-tuned from Gemma 4B for Tunisian law and legal instruction tasks.
This repository contains LoRA adapters only and does not include the base model weights.
20.1075Hedi-Bk/gemma-4b-tunisian-law-lora-2epochsKaggle notebook used for training:
This model was trained using the QLoRA method for legal-oriented tasks related to Tunisian law.
Despite the very low final loss (0.1075), the model showed very good generalization capabilities and strong response quality during testing.
The model did not exhibit problematic overfitting behavior during evaluation.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = "google/gemma-4b"
adapter_model = "Hedi-Bk/gemma-4b-tunisian-law-lora-2epochs"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(
base_model,
device_map="auto"
)
model = PeftModel.from_pretrained(
model,
adapter_model
)
prompt = "Explique le droit tunisien du travail."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This repository contains LoRA adapters only.
You must first download the base Gemma model before loading these adapters.
This project is intended for research and educational purposes only.
Generated legal content may contain inaccuracies and should not be considered professional legal advice.