devadigaprathamesh lbourdois commited on
Commit
91add5d
·
verified ·
1 Parent(s): 516a4ed

Improve language tag (#1)

Browse files

- Improve language tag (4e090d78b7e4c3d4d5c5a7328781ff3fc93829a5)


Co-authored-by: Loïck BOURDOIS <[email protected]>

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