louisbrulenaudet commited on
Commit
d7c1b9e
1 Parent(s): f9850a9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +80 -264
README.md CHANGED
@@ -1,13 +1,18 @@
1
  ---
 
2
  language:
3
  - fr
4
- license: apache-2.0
5
  multilinguality:
6
  - monolingual
7
- size_categories:
8
- - 1K<n<10K
 
 
 
 
9
  source_datasets:
10
  - original
 
11
  task_categories:
12
  - text-generation
13
  - table-question-answering
@@ -15,222 +20,29 @@ task_categories:
15
  - text-retrieval
16
  - question-answering
17
  - text-classification
18
- pretty_name: Code de l'artisanat
19
- tags:
20
- - finetuning
21
- - legal
22
- - french law
23
- - droit français
24
- - Code de l'artisanat
25
- configs:
26
- - config_name: default
27
- data_files:
28
- - split: train
29
- path: data/train-*
30
- dataset_info:
31
- features:
32
- - name: ref
33
- dtype: string
34
- - name: texte
35
- dtype: string
36
- - name: dateDebut
37
- dtype: int64
38
- - name: dateFin
39
- dtype: int64
40
- - name: num
41
- dtype: string
42
- - name: id
43
- dtype: string
44
- - name: cid
45
- dtype: string
46
- - name: type
47
- dtype: string
48
- - name: etat
49
- dtype: string
50
- - name: nota
51
- dtype: string
52
- - name: version_article
53
- dtype: string
54
- - name: ordre
55
- dtype: int64
56
- - name: conditionDiffere
57
- dtype: 'null'
58
- - name: infosComplementaires
59
- dtype: 'null'
60
- - name: surtitre
61
- dtype: 'null'
62
- - name: nature
63
- dtype: string
64
- - name: texteHtml
65
- dtype: string
66
- - name: dateFinExtension
67
- dtype: int64
68
- - name: versionPrecedente
69
- dtype: string
70
- - name: refInjection
71
- dtype: string
72
- - name: idTexte
73
- dtype: 'null'
74
- - name: idTechInjection
75
- dtype: string
76
- - name: origine
77
- dtype: string
78
- - name: dateDebutExtension
79
- dtype: int64
80
- - name: idEliAlias
81
- dtype: 'null'
82
- - name: cidTexte
83
- dtype: 'null'
84
- - name: sectionParentId
85
- dtype: string
86
- - name: multipleVersions
87
- dtype: bool
88
- - name: comporteLiensSP
89
- dtype: bool
90
- - name: sectionParentTitre
91
- dtype: string
92
- - name: infosRestructurationBranche
93
- dtype: 'null'
94
- - name: idEli
95
- dtype: 'null'
96
- - name: sectionParentCid
97
- dtype: string
98
- - name: numeroBo
99
- dtype: 'null'
100
- - name: infosRestructurationBrancheHtml
101
- dtype: 'null'
102
- - name: historique
103
- dtype: 'null'
104
- - name: infosComplementairesHtml
105
- dtype: 'null'
106
- - name: renvoi
107
- dtype: 'null'
108
- - name: fullSectionsTitre
109
- dtype: string
110
- - name: notaHtml
111
- dtype: string
112
- - name: inap
113
- dtype: 'null'
114
- splits:
115
- - name: train
116
- num_bytes: 1060397
117
- num_examples: 393
118
- download_size: 318794
119
- dataset_size: 1060397
120
  ---
121
- # Code de l'artisanat, non-instruct (2024-08-13)
122
 
123
- This project focuses on fine-tuning pre-trained language models to create efficient and accurate models for legal practice.
124
 
125
- Fine-tuning is the process of adapting a pre-trained model to perform specific tasks or cater to particular domains. It involves adjusting the model's parameters through a further round of training on task-specific or domain-specific data. While conventional fine-tuning strategies involve supervised learning with labeled data, instruction-based fine-tuning introduces a more structured and interpretable approach.
126
 
127
- Instruction-based fine-tuning leverages the power of human-provided instructions to guide the model's behavior. These instructions can be in the form of text prompts, prompts with explicit task descriptions, or a combination of both. This approach allows for a more controlled and context-aware interaction with the LLM, making it adaptable to a multitude of specialized tasks.
128
 
129
- Instruction-based fine-tuning significantly enhances the performance of LLMs in the following ways:
130
 
131
- - Task-Specific Adaptation: LLMs, when fine-tuned with specific instructions, exhibit remarkable adaptability to diverse tasks. They can switch seamlessly between translation, summarization, and question-answering, guided by the provided instructions.
132
- - Reduced Ambiguity: Traditional LLMs might generate ambiguous or contextually inappropriate responses. Instruction-based fine-tuning allows for a clearer and more context-aware generation, reducing the likelihood of nonsensical outputs.
133
- - Efficient Knowledge Transfer: Instructions can encapsulate domain-specific knowledge, enabling LLMs to benefit from expert guidance. This knowledge transfer is particularly valuable in fields like tax practice, law, medicine, and more.
134
- - Interpretability: Instruction-based fine-tuning also makes LLM behavior more interpretable. Since the instructions are human-readable, it becomes easier to understand and control model outputs.
135
- - Adaptive Behavior: LLMs, post instruction-based fine-tuning, exhibit adaptive behavior that is responsive to both explicit task descriptions and implicit cues within the provided text.
136
 
137
- ## Concurrent reading of the LegalKit
138
 
139
- To use all the legal data published on LegalKit, you can use this code snippet:
140
  ```python
141
  # -*- coding: utf-8 -*-
142
- import concurrent.futures
143
- import os
144
-
145
- import datasets
146
- from tqdm.notebook import tqdm
147
-
148
- def dataset_loader(
149
- name:str,
150
- streaming:bool=True
151
- ) -> datasets.Dataset:
152
- """
153
- Helper function to load a single dataset in parallel.
154
-
155
- Parameters
156
- ----------
157
- name : str
158
- Name of the dataset to be loaded.
159
-
160
- streaming : bool, optional
161
- Determines if datasets are streamed. Default is True.
162
-
163
- Returns
164
- -------
165
- dataset : datasets.Dataset
166
- Loaded dataset object.
167
-
168
- Raises
169
- ------
170
- Exception
171
- If an error occurs during dataset loading.
172
- """
173
- try:
174
- return datasets.load_dataset(
175
- name,
176
- split="train",
177
- streaming=streaming
178
- )
179
-
180
- except Exception as exc:
181
- logging.error(f"Error loading dataset {name}: {exc}")
182
-
183
- return None
184
-
185
-
186
- def load_datasets(
187
- req:list,
188
- streaming:bool=True
189
- ) -> list:
190
- """
191
- Downloads datasets specified in a list and creates a list of loaded datasets.
192
-
193
- Parameters
194
- ----------
195
- req : list
196
- A list containing the names of datasets to be downloaded.
197
-
198
- streaming : bool, optional
199
- Determines if datasets are streamed. Default is True.
200
-
201
- Returns
202
- -------
203
- datasets_list : list
204
- A list containing loaded datasets as per the requested names provided in 'req'.
205
-
206
- Raises
207
- ------
208
- Exception
209
- If an error occurs during dataset loading or processing.
210
-
211
- Examples
212
- --------
213
- >>> datasets = load_datasets(["dataset1", "dataset2"], streaming=False)
214
- """
215
- datasets_list = []
216
-
217
- with concurrent.futures.ThreadPoolExecutor() as executor:
218
- future_to_dataset = {executor.submit(dataset_loader, name): name for name in req}
219
-
220
- for future in tqdm(concurrent.futures.as_completed(future_to_dataset), total=len(req)):
221
- name = future_to_dataset[future]
222
-
223
- try:
224
- dataset = future.result()
225
-
226
- if dataset:
227
- datasets_list.append(dataset)
228
-
229
- except Exception as exc:
230
- logging.error(f"Error processing dataset {name}: {exc}")
231
-
232
- return datasets_list
233
-
234
 
235
  req = [
236
  "louisbrulenaudet/code-artisanat",
@@ -240,7 +52,7 @@ req = [
240
 
241
  datasets_list = load_datasets(
242
  req=req,
243
- streaming=True
244
  )
245
 
246
  dataset = datasets.concatenate_datasets(
@@ -248,60 +60,64 @@ dataset = datasets.concatenate_datasets(
248
  )
249
  ```
250
 
251
- ## Dataset generation
252
-
253
- This JSON file is a list of dictionaries, each dictionary contains the following fields:
254
-
255
- - `instruction`: `string`, presenting the instruction linked to the element.
256
- - `input`: `string`, signifying the input details for the element.
257
- - `output`: `string`, indicating the output information for the element.
258
- - `start`: `string`, the date of entry into force of the article.
259
- - `expiration`: `string`, the date of expiration of the article.
260
- - `num`: `string`, the id of the article.
261
-
262
- We used the following list of instructions for generating the dataset:
263
- ```python
264
- instructions = [
265
- "Compose l'intégralité de l'article sous forme écrite.",
266
- "Écris la totalité du contenu de l'article.",
267
- "Formule la totalité du texte présent dans l'article.",
268
- "Produis l'intégralité de l'article en écriture.",
269
- "Développe l'article dans son ensemble par écrit.",
270
- "Génère l'ensemble du texte contenu dans l'article.",
271
- "Formule le contenu intégral de l'article en entier.",
272
- "Rédige la totalité du texte de l'article en entier.",
273
- "Compose l'intégralité du contenu textuel de l'article.",
274
- "Rédige l'ensemble du texte qui constitue l'article.",
275
- "Formule l'article entier dans son contenu écrit.",
276
- "Composez l'intégralité de l'article sous forme écrite.",
277
- "Écrivez la totalité du contenu de l'article.",
278
- "Formulez la totalité du texte présent dans l'article.",
279
- "Développez l'article dans son ensemble par écrit.",
280
- "Générez l'ensemble du texte contenu dans l'article.",
281
- "Formulez le contenu intégral de l'article en entier.",
282
- "Rédigez la totalité du texte de l'article en entier.",
283
- "Composez l'intégralité du contenu textuel de l'article.",
284
- "Écrivez l'article dans son intégralité en termes de texte.",
285
- "Rédigez l'ensemble du texte qui constitue l'article.",
286
- "Formulez l'article entier dans son contenu écrit.",
287
- "Composer l'intégralité de l'article sous forme écrite.",
288
- "Écrire la totalité du contenu de l'article.",
289
- "Formuler la totalité du texte présent dans l'article.",
290
- "Produire l'intégralité de l'article en écriture.",
291
- "Développer l'article dans son ensemble par écrit.",
292
- "Générer l'ensemble du texte contenu dans l'article.",
293
- "Formuler le contenu intégral de l'article en entier.",
294
- "Rédiger la totalité du texte de l'article en entier.",
295
- "Composer l'intégralité du contenu textuel de l'article.",
296
- "Rédiger l'ensemble du texte qui constitue l'article.",
297
- "Formuler l'article entier dans son contenu écrit.",
298
- "Quelles sont les dispositions de l'article ?",
299
- "Quelles dispositions sont incluses dans l'article ?",
300
- "Quelles sont les dispositions énoncées dans l'article ?",
301
- "Quel est le texte intégral de l'article ?",
302
- "Quelle est la lettre de l'article ?"
303
- ]
304
- ```
 
 
 
 
305
 
306
  ## Feedback
307
 
 
1
  ---
2
+ license: apache-2.0
3
  language:
4
  - fr
 
5
  multilinguality:
6
  - monolingual
7
+ tags:
8
+ - finetuning
9
+ - legal
10
+ - french law
11
+ - droit français
12
+ - Code de l'artisanat
13
  source_datasets:
14
  - original
15
+ pretty_name: Code de l'artisanat
16
  task_categories:
17
  - text-generation
18
  - table-question-answering
 
20
  - text-retrieval
21
  - question-answering
22
  - text-classification
23
+ size_categories:
24
+ - 1K<n<10K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ---
26
+ # Code de l'artisanat, non-instruct (2024-08-14)
27
 
28
+ The objective of this project is to provide researchers, professionals and law students with simplified, up-to-date access to all French legal texts, enriched with a wealth of data to facilitate their integration into Community and European projects.
29
 
30
+ Normally, the data is refreshed daily on all legal codes, and aims to simplify the production of training sets and labeling pipelines for the development of free, open-source language models based on open data accessible to all.
31
 
32
+ ## Concurrent reading of the LegalKit
33
 
34
+ [<img src="https://raw.githubusercontent.com/louisbrulenaudet/ragoon/main/assets/badge.svg" alt="Built with RAGoon" width="200" height="32"/>](https://github.com/louisbrulenaudet/ragoon)
35
 
36
+ To use all the legal data published on LegalKit, you can use RAGoon:
37
+ ```bash
38
+ pip3 install ragoon
39
+ ```
 
40
 
41
+ Then, you can load multiple datasets using this code snippet:
42
 
 
43
  ```python
44
  # -*- coding: utf-8 -*-
45
+ from ragoon import load_datasets
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  req = [
48
  "louisbrulenaudet/code-artisanat",
 
52
 
53
  datasets_list = load_datasets(
54
  req=req,
55
+ streaming=False
56
  )
57
 
58
  dataset = datasets.concatenate_datasets(
 
60
  )
61
  ```
62
 
63
+ ### Data Structure for Article Information
64
+
65
+ This section provides a detailed overview of the elements contained within the `item` dictionary. Each key represents a specific attribute of the legal article, with its associated value providing detailed information.
66
+
67
+ 1. **Basic Information**
68
+ - `ref` (string): **Reference** - A reference to the article, combining the title_main and the article `number` (e.g., "Code Général des Impôts, art. 123").
69
+ - `texte` (string): **Text Content** - The textual content of the article.
70
+ - `dateDebut` (string): **Start Date** - The date when the article came into effect.
71
+ - `dateFin` (string): **End Date** - The date when the article was terminated or superseded.
72
+ - `num` (string): **Article Number** - The number assigned to the article.
73
+ - `id` (string): **Article ID** - Unique identifier for the article.
74
+ - `cid` (string): **Chronical ID** - Chronical identifier for the article.
75
+ - `type` (string): **Type** - The type or classification of the document (e.g., "AUTONOME").
76
+ - `etat` (string): **Legal Status** - The current legal status of the article (e.g., "MODIFIE_MORT_NE").
77
+
78
+ 2. **Content and Notes**
79
+ - `nota` (string): **Notes** - Additional notes or remarks associated with the article.
80
+ - `version_article` (string): **Article Version** - The version number of the article.
81
+ - `ordre` (integer): **Order Number** - A numerical value used to sort articles within their parent section.
82
+
83
+ 3. **Additional Metadata**
84
+ - `conditionDiffere` (string): **Deferred Condition** - Specific conditions related to collective agreements.
85
+ - `infosComplementaires` (string): **Additional Information** - Extra information pertinent to the article.
86
+ - `surtitre` (string): **Subtitle** - A subtitle or additional title information related to collective agreements.
87
+ - `nature` (string): **Nature** - The nature or category of the document (e.g., "Article").
88
+ - `texteHtml` (string): **HTML Content** - The article's content in HTML format.
89
+
90
+ 4. **Versioning and Extensions**
91
+ - `dateFinExtension` (string): **End Date of Extension** - The end date if the article has an extension.
92
+ - `versionPrecedente` (string): **Previous Version** - Identifier for the previous version of the article.
93
+ - `refInjection` (string): **Injection Reference** - Technical reference to identify the date of injection.
94
+ - `idTexte` (string): **Text ID** - Identifier for the legal text to which the article belongs.
95
+ - `idTechInjection` (string): **Technical Injection ID** - Technical identifier for the injected element.
96
+
97
+ 5. **Origin and Relationships**
98
+ - `origine` (string): **Origin** - The origin of the document (e.g., "LEGI").
99
+ - `dateDebutExtension` (string): **Start Date of Extension** - The start date if the article has an extension.
100
+ - `idEliAlias` (string): **ELI Alias** - Alias for the European Legislation Identifier (ELI).
101
+ - `cidTexte` (string): **Text Chronical ID** - Chronical identifier of the text.
102
+
103
+ 6. **Hierarchical Relationships**
104
+ - `sectionParentId` (string): **Parent Section ID** - Technical identifier of the parent section.
105
+ - `multipleVersions` (boolean): **Multiple Versions** - Indicates if the article has multiple versions.
106
+ - `comporteLiensSP` (boolean): **Contains Public Service Links** - Indicates if the article contains links to public services.
107
+ - `sectionParentTitre` (string): **Parent Section Title** - Title of the parent section (e.g., "I : Revenu imposable").
108
+ - `infosRestructurationBranche` (string): **Branch Restructuring Information** - Information about branch restructuring.
109
+ - `idEli` (string): **ELI ID** - European Legislation Identifier (ELI) for the article.
110
+ - `sectionParentCid` (string): **Parent Section Chronical ID** - Chronical identifier of the parent section.
111
+
112
+ 7. **Additional Content and History**
113
+ - `numeroBo` (string): **Official Bulletin Number** - Number of the official bulletin where the article was published.
114
+ - `infosRestructurationBrancheHtml` (string): **Branch Restructuring Information (HTML)** - Branch restructuring information in HTML format.
115
+ - `historique` (string): **History** - Historical context or changes specific to collective agreements.
116
+ - `infosComplementairesHtml` (string): **Additional Information (HTML)** - Additional information in HTML format.
117
+ - `renvoi` (string): **Reference** - References to content within the article (e.g., "(1)").
118
+ - `fullSectionsTitre` (string): **Full Section Titles** - Concatenation of all titles in the parent chain.
119
+ - `notaHtml` (string): **Notes (HTML)** - Additional notes or remarks in HTML format.
120
+ - `inap` (string): **INAP** - A placeholder for INAP-specific information.
121
 
122
  ## Feedback
123