Improve language tag (#1)
Browse files- Improve language tag (4e090d78b7e4c3d4d5c5a7328781ff3fc93829a5)
Co-authored-by: Loïck BOURDOIS <[email protected]>
README.md
CHANGED
@@ -1,180 +1,191 @@
|
|
1 |
-
---
|
2 |
-
language:
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
-
|
60 |
-
-
|
61 |
-
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
-
|
71 |
-
-
|
72 |
-
-
|
73 |
-
-
|
74 |
-
-
|
75 |
-
-
|
76 |
-
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
-
|
85 |
-
-
|
86 |
-
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
#
|
129 |
-
|
130 |
-
print(
|
131 |
-
```
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
```
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
```
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
##
|
160 |
-
-
|
161 |
-
-
|
162 |
-
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
- Creator of the "viber1/indian-law-dataset"
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- zho
|
4 |
+
- eng
|
5 |
+
- fra
|
6 |
+
- spa
|
7 |
+
- por
|
8 |
+
- deu
|
9 |
+
- ita
|
10 |
+
- rus
|
11 |
+
- jpn
|
12 |
+
- kor
|
13 |
+
- vie
|
14 |
+
- tha
|
15 |
+
- ara
|
16 |
+
license: apache-2.0
|
17 |
+
library_name: transformers
|
18 |
+
tags:
|
19 |
+
- qwen
|
20 |
+
- lora
|
21 |
+
- indian-law
|
22 |
+
- legal-ai
|
23 |
+
- finetune
|
24 |
+
datasets:
|
25 |
+
- viber1/indian-law-dataset
|
26 |
+
base_model: Qwen/Qwen2.5-7B
|
27 |
+
inference:
|
28 |
+
parameters:
|
29 |
+
temperature: 0.7
|
30 |
+
top_p: 0.9
|
31 |
+
repetition_penalty: 1.1
|
32 |
+
max_new_tokens: 512
|
33 |
+
model-index:
|
34 |
+
- name: JurisQwen
|
35 |
+
results:
|
36 |
+
- task:
|
37 |
+
type: text-generation
|
38 |
+
name: Legal Text Generation
|
39 |
+
dataset:
|
40 |
+
name: Indian Law Dataset
|
41 |
+
type: viber1/indian-law-dataset
|
42 |
+
metrics:
|
43 |
+
- type: loss
|
44 |
+
value: N/A
|
45 |
+
name: Training Loss
|
46 |
+
---
|
47 |
+
|
48 |
+
# JurisQwen: Legal Domain Fine-tuned Qwen2.5-7B Model
|
49 |
+
|
50 |
+
## Overview
|
51 |
+
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.
|
52 |
+
|
53 |
+
## Model Details
|
54 |
+
|
55 |
+
### Model Description
|
56 |
+
- **Developed by:** Prathamesh Devadiga
|
57 |
+
- **Base Model:** Qwen2.5-7B by Qwen
|
58 |
+
- **Model Type:** Language Model with LoRA fine-tuning
|
59 |
+
- **Language:** English with focus on Indian legal terminology
|
60 |
+
- **License:** Apache-2.0
|
61 |
+
- **Finetuned from model:** Qwen/Qwen2.5-7B
|
62 |
+
- **Framework:** PEFT 0.15.1 with Unsloth optimization
|
63 |
+
|
64 |
+
### Training Dataset
|
65 |
+
The model was fine-tuned on the "viber1/indian-law-dataset" which contains instruction-response pairs focused on Indian legal knowledge and terminology.
|
66 |
+
|
67 |
+
## Technical Specifications
|
68 |
+
|
69 |
+
### Model Architecture
|
70 |
+
- Base model: Qwen2.5-7B
|
71 |
+
- Fine-tuning method: LoRA (Low-Rank Adaptation)
|
72 |
+
- LoRA configuration:
|
73 |
+
- Rank (r): 32
|
74 |
+
- Alpha: 64
|
75 |
+
- Dropout: 0.05
|
76 |
+
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
|
77 |
+
|
78 |
+
### Training Procedure
|
79 |
+
- **Training Infrastructure:** NVIDIA A100-40GB GPU
|
80 |
+
- **Quantization:** 4-bit quantization using bitsandbytes
|
81 |
+
- **Mixed Precision:** bfloat16
|
82 |
+
- **Attention Implementation:** Flash Attention 2
|
83 |
+
- **Training Hyperparameters:**
|
84 |
+
- Epochs: 3
|
85 |
+
- Batch size: 16
|
86 |
+
- Gradient accumulation steps: 2
|
87 |
+
- Learning rate: 2e-4
|
88 |
+
- Weight decay: 0.001
|
89 |
+
- Scheduler: Cosine with 10% warmup
|
90 |
+
- Optimizer: AdamW 8-bit
|
91 |
+
- Maximum sequence length: 4096
|
92 |
+
- TF32 enabled for A100
|
93 |
+
|
94 |
+
### Deployment Infrastructure
|
95 |
+
- Deployed using Modal cloud platform
|
96 |
+
- GPU: NVIDIA A100-40GB
|
97 |
+
- Persistent volume storage for model checkpoints
|
98 |
+
|
99 |
+
## Usage
|
100 |
+
|
101 |
+
### Setting Up the Environment
|
102 |
+
This model is deployed using Modal. To use it, you'll need to:
|
103 |
+
|
104 |
+
1. Install Modal:
|
105 |
+
```bash
|
106 |
+
pip install modal
|
107 |
+
```
|
108 |
+
|
109 |
+
2. Authenticate with Modal:
|
110 |
+
```bash
|
111 |
+
modal token new
|
112 |
+
```
|
113 |
+
|
114 |
+
3. Deploy the application:
|
115 |
+
```bash
|
116 |
+
python app.py
|
117 |
+
```
|
118 |
+
|
119 |
+
### Running Fine-tuning
|
120 |
+
To run the fine-tuning process:
|
121 |
+
|
122 |
+
```python
|
123 |
+
from app import app, finetune_qwen
|
124 |
+
|
125 |
+
# Deploy the app
|
126 |
+
app.deploy()
|
127 |
+
|
128 |
+
# Run fine-tuning
|
129 |
+
result = finetune_qwen.remote()
|
130 |
+
print(f"Fine-tuning result: {result}")
|
131 |
+
```
|
132 |
+
|
133 |
+
### Inference
|
134 |
+
To run inference with the fine-tuned model:
|
135 |
+
|
136 |
+
```python
|
137 |
+
from app import app, test_inference
|
138 |
+
|
139 |
+
# Example legal query
|
140 |
+
response = test_inference.remote("What are the key provisions of the Indian Contract Act?")
|
141 |
+
print(response)
|
142 |
+
```
|
143 |
+
|
144 |
+
## Input Format
|
145 |
+
The model uses the following format for prompts:
|
146 |
+
```
|
147 |
+
<|im_start|>user
|
148 |
+
[Your legal question here]
|
149 |
+
<|im_end|>
|
150 |
+
```
|
151 |
+
|
152 |
+
The model will respond with:
|
153 |
+
```
|
154 |
+
<|im_start|>assistant
|
155 |
+
[Legal response]
|
156 |
+
<|im_end|>
|
157 |
+
```
|
158 |
+
|
159 |
+
## Limitations and Biases
|
160 |
+
- The model is specifically trained on Indian legal data and may not generalize well to other legal systems
|
161 |
+
- Legal advice provided by the model should not be considered as professional legal counsel
|
162 |
+
- The model may exhibit biases present in the training data
|
163 |
+
- Performance on complex or novel legal scenarios not present in the training data may be limited
|
164 |
+
|
165 |
+
## Recommendations
|
166 |
+
- Users should validate important legal information with qualified legal professionals
|
167 |
+
- Always cross-reference model outputs with authoritative legal sources
|
168 |
+
- Be aware that legal interpretations may vary and the model provides one possible interpretation
|
169 |
+
|
170 |
+
## Environmental Impact
|
171 |
+
- Hardware: NVIDIA A100-40GB GPU
|
172 |
+
- Training time: Approximately 3-5 hours
|
173 |
+
- Cloud Provider: Modal
|
174 |
+
|
175 |
+
## Citation
|
176 |
+
If you use this model in your research, please cite:
|
177 |
+
|
178 |
+
```
|
179 |
+
@software{JurisQwen,
|
180 |
+
author = {Prathamesh Devadiga},
|
181 |
+
title = {JurisQwen: Indian Legal Domain Fine-tuned Qwen2.5-7B Model},
|
182 |
+
year = {2025},
|
183 |
+
url = {https://github.com/devadigapratham/JurisQwen}
|
184 |
+
}
|
185 |
+
```
|
186 |
+
|
187 |
+
## Acknowledgments
|
188 |
+
- Qwen team for the original Qwen2.5-7B model
|
189 |
+
- Unsloth for optimization tools
|
190 |
+
- Modal for deployment infrastructure
|
191 |
- Creator of the "viber1/indian-law-dataset"
|