JurisQwen: Legal Domain Fine-tuned Qwen2.5-7B Model
Overview
JurisQwen is a specialized legal domain language model based on Qwen2.5-7B, fine-tuned on Indian legal datasets. This model is designed to assist with legal queries, document analysis, and providing information about Indian law.
Model Details
Model Description
Developed by: Prathamesh Devadiga
Base Model: Qwen2.5-7B by Qwen
Model Type: Language Model with LoRA fine-tuning
Language: English with focus on Indian legal terminology
License: Apache-2.0
Finetuned from model: Qwen/Qwen2.5-7B
Framework: PEFT 0.15.1 with Unsloth optimization
Training Dataset
The model was fine-tuned on the "viber1/indian-law-dataset" which contains instruction-response pairs focused on Indian legal knowledge and terminology.
Quantization: 4-bit quantization using bitsandbytes
Mixed Precision: bfloat16
Attention Implementation: Flash Attention 2
Training Hyperparameters:
Epochs: 3
Batch size: 16
Gradient accumulation steps: 2
Learning rate: 2e-4
Weight decay: 0.001
Scheduler: Cosine with 10% warmup
Optimizer: AdamW 8-bit
Maximum sequence length: 4096
TF32 enabled for A100
Deployment Infrastructure
Deployed using Modal cloud platform
GPU: NVIDIA A100-40GB
Persistent volume storage for model checkpoints
Usage
Setting Up the Environment
This model is deployed using Modal. To use it, you'll need to:
Install Modal:
pip install modal
Authenticate with Modal:
modal token new
Deploy the application:
python app.py
Running Fine-tuning
To run the fine-tuning process:
python
1from app import app, finetune_qwen
23# Deploy the app4app.deploy()56# Run fine-tuning7result = finetune_qwen.remote()8print(f"Fine-tuning result: {result}")
Inference
To run inference with the fine-tuned model:
python
1from app import app, test_inference
23# Example legal query4response = test_inference.remote("What are the key provisions of the Indian Contract Act?")5print(response)