dotzcode's picture
Update README.md
6743d4b verified
|
Raw History Blame Contribute Delete
4.55 kB
---
base_model: google/gemma-2-2b-it
library_name: peft
pipeline_tag: text-generation
tags:
- base_model:adapter:google/gemma-2-2b-it
- lora
- transformers
- legal
- indian-law
- bare-acts
- bns
- bnss
- bsa
license: gemma
language:
- en
---
# 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
```python
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)
----------------------------------------------------------------------------------------------