Instructions to use dotzcode/gemma-2-indian-bare-acts with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use dotzcode/gemma-2-indian-bare-acts with PEFT:
Task type is invalid.
- Transformers
How to use dotzcode/gemma-2-indian-bare-acts with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dotzcode/gemma-2-indian-bare-acts")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("dotzcode/gemma-2-indian-bare-acts", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dotzcode/gemma-2-indian-bare-acts with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dotzcode/gemma-2-indian-bare-acts" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dotzcode/gemma-2-indian-bare-acts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/dotzcode/gemma-2-indian-bare-acts
- SGLang
How to use dotzcode/gemma-2-indian-bare-acts with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dotzcode/gemma-2-indian-bare-acts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dotzcode/gemma-2-indian-bare-acts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dotzcode/gemma-2-indian-bare-acts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dotzcode/gemma-2-indian-bare-acts", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use dotzcode/gemma-2-indian-bare-acts with Docker Model Runner:
docker model run hf.co/dotzcode/gemma-2-indian-bare-acts
gemma-2-indian-bare-acts
This is a parameter-efficient fine-tuned (PEFT / LoRA) adapter for Google's Gemma-2-2b-it, trained specifically on central and statutory Indian Bare Acts.
Model Details
Model Description
dotzcode/gemma-2-indian-bare-acts adapts Google's Gemma 2 2B Instruct model for accurate statutory interpretation, legal querying, and understanding statutory provisions, definitions, and penalties under Indian jurisprudence.
- Model Name:
dotzcode/gemma-2-indian-bare-acts - Developed by: dotzcode
- Model Type: PEFT LoRA Adapter (Causal Language Model)
- Base Model:
google/gemma-2-2b-it - Language(s) (NLP): English (Statutory text & legal terminology)
- License: gemma
- Finetuned from model: google/gemma-2-2b-it
Statutory Frameworks Covered
- Reformed Criminal Codes: Bharatiya Nyaya Sanhita (BNS), Bharatiya Nagarik Suraksha Sanhita (BNSS), and Bharatiya Sakshya Adhiniyam (BSA).
- Historic Codes & Cross-References: Indian Penal Code (IPC), Code of Criminal Procedure (CrPC), and Indian Evidence Act (IEA).
- Constitutional Law: The Constitution of India (Articles, Schedules, and Fundamental Rights).
- Civil & Commercial Acts: Indian Contract Act, Negotiable Instruments Act, Companies Act, and Code of Civil Procedure (CPC).
Uses
Direct Use
- Querying specific legal sections, definitions, statutory exceptions, and punishable offenses under Indian law.
- Cross-referencing transitional mappings between historic penal laws (IPC/CrPC/IEA) and reformed codes (BNS/BNSS/BSA).
- Educational and assistive legal research.
Downstream Use
- Integrating into Retrieval-Augmented Generation (RAG) pipelines for legal question answering and statutory document assistants.
Out-of-Scope Use
- Automated formal legal counsel or unverified courtroom drafting.
- High-stakes judicial decisions without qualified legal review.
Bias, Risks, and Limitations
- Hallucinations: Language models may occasionally miscite subsections, procedural conditions, or penalty durations.
- Statutory Revisions: Judicial precedents and statutory amendments evolve over time; answers should always be cross-referenced with official Gazette notifications.
Recommendations
All outputs should be treated as research assistance and verified against authoritative statutory texts and primary sources.
#Training Details
Training Data
Trained on instruction-tuned statutory datasets encompassing Indian Bare Acts, cross-code transition tables (IPC to BNS), and section-by-section legal provisions.
Training Procedure
- Fine-Tuning Method: Low-Rank Adaptation (LoRA / PEFT)
- Precision: Mixed precision (
bfloat16) - Objective: Causal Language Modeling / Instruction Tuning
Legal Disclaimer
Disclaimer: This model is designed solely for educational, academic, and assistive research purposes. It does not constitute certified legal counsel or formal legal advice under the Advocates Act, 1961. Always consult a qualified advocate for actionable legal matters.
Framework versions
- PEFT 0.16.0
- Transformers
- PyTorch
How to Get Started with the Model
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_id = "google/gemma-2-2b-it"
adapter_id = "dotzcode/gemma-2-indian-bare-acts"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
messages = [
{
"role": "user",
"content": "Explain the essential elements and punishment for theft under Section 303 of the Bharatiya Nyaya Sanhita (BNS)."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=350,
temperature=0.2,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
----------------------------------------------------------------------------------------------
- Downloads last month
- -