Downloads · 30 days
17
41% of all-time downloads
jshardul26/indian-legal-qwen2.5-1.5b-lora
indian-legal-qwen2.5-1.5b-lora is a machine learning model from jshardul26. 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. The card lists the license as apache-2.0.
LoRA adapter fine-tuned on top of Qwen/Qwen2.5-1.5B-Instruct for Indian legal question-answering (IPC, CrPC, Constitution, Evidence Act, torts, etc.).
Downloads · 30 days
17
41% of all-time downloads
All-time downloads
41
Public
Repo size
235 MB
Likes
0
Public
Click a slice to open those files.
.safetensors222 MB · 67%
From the Hugging Face model README
LoRA adapter fine-tuned on top of Qwen/Qwen2.5-1.5B-Instruct for Indian legal question-answering (IPC, CrPC, Constitution, Evidence Act, torts, etc.).
This model is a personal / educational project, not a substitute for professional legal advice. It can produce factually incorrect or hallucinated statements, including invented section numbers, dates, or conflated statutes. Always verify any legal information against primary sources (bare acts, official gazettes) or consult a qualified lawyer before relying on it.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-1.5B-Instruct"
adapter_id = "jshardul26/indian-legal-qwen2.5-1.5b-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
messages = [{"role": "user", "content": "Explain Section 420 of IPC."}]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=False, pad_token_id=tokenizer.pad_token_id)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
LoRA fine-tuning on a curated Indian legal QA dataset. See the training repo for data preparation and hyperparameters.