Instructions to use hug-baahubali/LawyerGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use hug-baahubali/LawyerGPT with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-14b-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "hug-baahubali/LawyerGPT") - Notebooks
- Google Colab
- Kaggle
LawyerGPT – A Legal AI Assistant for Indian Law
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.
Model Details
Model Description
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.
- Developed by: [More Information Needed]
- Shared by: hug-baahubali
- Model type: Causal Language Model (LoRA fine-tuned)
- Language(s): English
- License: [Specify license used]
- Finetuned from:
unsloth/qwen3-14b-unsloth-bnb-4bit
Model Sources
- Model on Hugging Face: https://huggingface.co/hug-baahubali/LawyerGPT
Uses
Direct Use
Legal chatbot applications, legal research support, citizen legal awareness platforms, and initial legal triage systems.
Downstream Use
Can be used as a foundation for specialized legal AI systems, court automation tools, or legal document assistants focused on Indian law.
Out-of-Scope Use
- Generating binding legal advice in court
- Usage in non-Indian jurisdictions without adaptation
- Sensitive legal scenarios without human oversight
Bias, Risks, and Limitations
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.
Recommendations
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.
How to Get Started with the Model
!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
- Downloads last month
- 3