delimi commited on
Commit
7977f6f
·
verified ·
1 Parent(s): 6207cb5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -22
README.md CHANGED
@@ -1,4 +1,3 @@
1
- ---
2
  license: apache-2.0
3
  base_model: mistralai/Mistral-7B-Instruct-v0.3
4
  tags:
@@ -6,23 +5,40 @@ tags:
6
  - french
7
  - mistral
8
  - fine-tuned
9
- - merged
10
  pipeline_tag: text-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
- # AIAJ: Fine-Tuned Mistral-7B for French Legal Tasks
14
-
15
- This model is a **merged version** of a fine-tuned `mistralai/Mistral-7B-Instruct-v0.3` for French legal tasks, including legal Q&A, template generation, and personalized document creation.
16
 
17
- The model was fine-tuned using LoRA (r=4) and then merged with the base model for easy deployment.
18
 
19
- ## Usage
20
 
21
  ```python
22
  from transformers import AutoModelForCausalLM, AutoTokenizer
23
  import torch
24
 
25
- # Load model and tokenizer
26
  model = AutoModelForCausalLM.from_pretrained(
27
  "delimi/Mistral_Legal",
28
  torch_dtype=torch.float16,
@@ -30,23 +46,70 @@ model = AutoModelForCausalLM.from_pretrained(
30
  )
31
  tokenizer = AutoTokenizer.from_pretrained("delimi/Mistral_Legal")
32
 
33
- # Generate text
34
- prompt = "Votre question juridique ici..."
 
 
 
 
 
 
 
35
  inputs = tokenizer(prompt, return_tensors="pt")
36
- outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
 
 
 
 
 
 
37
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
- ## Training Details
41
- - **Base Model**: mistralai/Mistral-7B-Instruct-v0.3
42
- - **Dataset**: 541 examples (reduced to 150 for training)
43
- - **Fine-tuning Method**: LoRA (rank=4)
44
- - **Epochs**: 2
45
- - **Final Training Loss**: 1.142047
46
- - **Final Validation Loss**: 1.0820
47
- - **Training Date**: 2025-05-27 11:58:06 CEST
48
 
49
- ## Model Type
50
- This is a **complete merged model** - no additional base model loading required.
 
 
51
 
52
- For more details, contact the project team.
 
 
 
1
  license: apache-2.0
2
  base_model: mistralai/Mistral-7B-Instruct-v0.3
3
  tags:
 
5
  - french
6
  - mistral
7
  - fine-tuned
8
+ - text-generation
9
  pipeline_tag: text-generation
10
+ inference: true
11
+ library_name: transformers
12
+ widget:
13
+ - text: "Génère une mise en demeure pour un loyer impayé de 1500 euros depuis 2 mois:"
14
+ example_title: "Mise en demeure"
15
+ - text: "Rédige un contrat de vente pour une voiture:"
16
+ example_title: "Contrat de vente"
17
+ - text: "Crée une clause de confidentialité:"
18
+ example_title: "Clause juridique"
19
+ model-index:
20
+ - name: Mistral_Legal
21
+ results:
22
+ - task:
23
+ type: text-generation
24
+ name: Text Generation
25
+ metrics:
26
+ - type: rouge
27
+ value: 0.35
28
+ name: ROUGE-1
29
  ---
30
 
31
+ # 🏛️ Mistral Legal - French Legal Document Generator
 
 
32
 
33
+ A specialized French legal document generation model based on Mistral-7B-Instruct-v0.3.
34
 
35
+ ## 🚀 Quick Start
36
 
37
  ```python
38
  from transformers import AutoModelForCausalLM, AutoTokenizer
39
  import torch
40
 
41
+ # Load model
42
  model = AutoModelForCausalLM.from_pretrained(
43
  "delimi/Mistral_Legal",
44
  torch_dtype=torch.float16,
 
46
  )
47
  tokenizer = AutoTokenizer.from_pretrained("delimi/Mistral_Legal")
48
 
49
+ # Generate legal document
50
+ prompt = \"\"\"Génère une mise en demeure pour:
51
+ **Situation**: Loyer impayé
52
+ **Montant**: 1,500 euros
53
+ **Locataire**: M. Martin
54
+ **Délai**: 15 jours
55
+
56
+ Mise en demeure:\"\"\"
57
+
58
  inputs = tokenizer(prompt, return_tensors="pt")
59
+ outputs = model.generate(
60
+ **inputs,
61
+ max_new_tokens=400,
62
+ temperature=0.7,
63
+ do_sample=True,
64
+ top_p=0.9
65
+ )
66
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
67
+ print(response)
68
+ ```
69
+
70
+ ## 🎯 Capabilities
71
+
72
+ - **Mise en demeure** (formal demands)
73
+ - **Contracts** (sales, rental, service agreements)
74
+ - **Legal clauses** (confidentiality, liability, etc.)
75
+ - **Legal correspondence**
76
+ - **Template generation**
77
+
78
+ ## 📊 Performance
79
+
80
+ - **Training Loss**: 1.142
81
+ - **Validation Loss**: 1.082
82
+ - **Dataset**: 541 French legal examples
83
+ - **Method**: LoRA fine-tuning + merge
84
+
85
+ ## ⚖️ Legal Disclaimer
86
+
87
+ This model is for assistance purposes only. All generated content should be reviewed by qualified legal professionals before use.
88
+
89
+ ## 🔧 Technical Details
90
+
91
+ - **Base**: mistralai/Mistral-7B-Instruct-v0.3
92
+ - **Parameters**: 7B
93
+ - **Language**: French
94
+ - **Domain**: Legal documents
95
+ - **License**: Apache 2.0
96
+
97
+ ## 📈 Usage Examples
98
+
99
+ ### Mise en demeure
100
+ ```
101
+ Génère une mise en demeure pour un loyer impayé de 2,400 euros depuis 3 mois.
102
  ```
103
 
104
+ ### Contract Generation
105
+ ```
106
+ Rédige un contrat de vente pour une voiture Peugeot 208 au prix de 15,000 euros.
107
+ ```
 
 
 
 
108
 
109
+ ### Legal Clauses
110
+ ```
111
+ Crée une clause de confidentialité pour un accord commercial d'une durée de 2 ans.
112
+ ```
113
 
114
+ ---
115
+ *Model created by AIAJ team - {datetime.now().strftime('%B %Y')}*