Downloads · 30 days
2
8% of all-time downloads
hug-baahubali/LawyerGPT
LawyerGPT is a text generation model from hug-baahubali. Use it when you need the model to write or continue text. It is set up for peft.
LawyerGPT is a domain-specialized conversational AI model finetuned to provide legal assistance under Indian law. It delivers context-aware, practical, and actionable legal advice while ensuring clarity and user-frien…
Downloads · 30 days
2
8% of all-time downloads
All-time downloads
26
Public
Repo size
268 MB
Likes
0
Public
Click a slice to open those files.
.safetensors257 MB · 94%
From the Hugging Face model README
LawyerGPT is a domain-specialized conversational AI model finetuned to provide legal assistance under Indian law. It delivers context-aware, practical, and actionable legal advice while ensuring clarity and user-friendliness.
LawyerGPT is finetuned on top of unsloth/qwen3-14b-unsloth-bnb-4bit using PEFT and LoRA techniques, with a focus on legal consultation tasks grounded in Indian law. Its purpose is to assist users in understanding their legal rights, processes, and next steps through natural and client-friendly communication.
unsloth/qwen3-14b-unsloth-bnb-4bitLegal chatbot applications, legal research support, citizen legal awareness platforms, and initial legal triage systems.
Can be used as a foundation for specialized legal AI systems, court automation tools, or legal document assistants focused on Indian law.
This model is not a substitute for professional legal advice. Always consult a certified lawyer for critical legal decisions. Responses may contain inaccuracies or oversimplifications and should not be blindly trusted for high-stakes matters.
Users should use this model with caution and validate its output against updated Indian legal sources. It is recommended for exploratory and educational use, not as a standalone legal authority.
!pip install -U bitsandbytes
!pip install accelerate
from peft import PeftModel
from transformers import Qwen3ForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
# Load base model
base_model = Qwen3ForCausalLM.from_pretrained("unsloth/qwen3-14b-unsloth-bnb-4bit")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "hug-baahubali/LawyerGPT")
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-14B")
# Sample query
query = "My husband says he moved all his money to his mom's account. How can I make sure the court still counts that as marital property?"
# System prompt template
system_prompt = '''You are a legal AI assistant specializing in Indian law. Your objective is to generate a comprehensive, actionable answer to each user’s legal question, tailored to their unique context.
Guidelines:
1. Base your answer entirely on the question provided and your expert legal knowledge. When needed, supplement your response with information from reputable Indian legal or government sources.
2. Ensure every response is thorough, practical, and well-organized—at least 10 detailed sentences or bullet points.
3. Adopt the voice of a trusted lawyer advising a client—clear, realistic, and conversational.
4. Avoid academic, formal, or exam-style language. Do not use legal jargon without immediately explaining it in everyday terms.
5. When extra background or legal details are needed for a complete answer, identify these missing pieces and explain how obtaining this information would affect your advice.
6. Always cite essential legal provisions or procedural steps from authoritative Indian sources when you reference them.
7. Maintain the highest standards of legal accuracy, ethics, and client-centered communication.
8. Your primary goal is to empower each user—clarify their legal options, realistic risks or barriers, and next steps under Indian law.
Every answer should leave the user feeling informed, supported, and equipped to take action.
'''
# Apply chat format
chat = [
{'role': "system", "content": system_prompt},
{'role': "user", "content": query}
]
text_input = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
from transformers import TextStreamer
streamer = TextStreamer(tokenizer, skip_prompt=True)
# Generate
with torch.no_grad():
inputs = tokenizer(text_input, return_tensors="pt").to('cuda')
generated_ids = model.generate(
**inputs,
streamer=streamer,
max_new_tokens=512
)
You can also try it in Colab (https://colab.research.google.com/drive/1eF-Pvcw5eJ2UXDED7H5hWeCvOy1fDg7T?usp=sharing)
Framework versions:
transformers: ≥4.39
peft: 0.15.2
accelerate: latest
bitsandbytes: latest