Downloads · 30 days
5
5% of all-time downloads
fizzarif7/llama2_pklaw_gpt
llama2_pklaw_gpt is a machine learning model from fizzarif7. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
This repository contains LoRA adapter weights for LLaMA-2-7B-Chat, fine-tuned on a Pakistani legal Q&A dataset using QLoRA (4-bit quantization).
Downloads · 30 days
5
5% of all-time downloads
All-time downloads
95
Public
Repo size
17.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors16.8 MB · 80%
From the Hugging Face model README
This repository contains LoRA adapter weights for LLaMA-2-7B-Chat, fine-tuned on a Pakistani legal Q&A dataset using QLoRA (4-bit quantization).
The model is intended for legal information retrieval and educational purposes only.
⚠️ It should not be used as a substitute for professional legal advice.
You need a GPU runtime (preferably T4 or higher).
In Colab, go to:
Runtime ➝ Change runtime type ➝ Select T4\GPU.
Dataset.csv).Users must verify answers against official legal sources before acting upon them.
Example Usage
@misc{fizza2025paklawqlora,
This is the fine-tuned model on HF only contains the LoRA adapter weights. When you try to from_pretrained(...), 🤗 Transformers automatically tries to fetch the base model: meta-llama/Llama-2-7b-chat-hf. That base repo is gated (you need to request access on Hugging Face) and also you must be logged in with your HF token.
from huggingface_hub import login
login(token="YourHFTokenHere")
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
base_model = "meta-llama/Llama-2-7b-chat-hf" # gated model
adapter_model = "fizzarif7/llama2_pklaw_gpt" # your LoRA fine-tuned repo
# Load tokenizer ---
tokenizer = AutoTokenizer.from_pretrained(base_model)
# quantization to save VRAM ---
bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16)
# Load base model ---
model = AutoModelForCausalLM.from_pretrained(
base_model,
quantization_config=bnb_config,
device_map="auto"
)
# --- Load LoRA adapter ---
model = PeftModel.from_pretrained(model, adapter_model)
# Examplpe Usage
prompt = "What is the importance of the general manager under Pakistani corporate law?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.7,
top_p=0.9
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))