Upload README.md with huggingface_hub
Browse files123456789101112131 unmodified line151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352363 unmodified lines2402412422432442452461 unmodified line248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307---language:- frlicense: apache-2.0multilinguality:- monolingualsize_categories:- 1K<n<10Ksource_datasets:- originaltask_categories:- text-generation- table-question-answering1 unmodified line- text-retrieval- question-answering- text-classificationpretty_name: Code de commercetags:- finetuning- legal- french law- droit français- Code de commerceconfigs:- config_name: defaultdata_files:- split: trainpath: data/train-*dataset_info:features:- name: refdtype: string- name: textedtype: string- name: dateDebutdtype: int64- name: dateFindtype: int64- name: numdtype: string- name: iddtype: string- name: ciddtype: string- name: typedtype: string- name: etatdtype: string- name: notadtype: string- name: version_articledtype: string- name: ordredtype: int64- name: conditionDifferedtype: 'null'- name: infosComplementairesdtype: 'null'- name: surtitredtype: 'null'- name: naturedtype: string- name: texteHtmldtype: string- name: dateFinExtensiondtype: int64- name: versionPrecedentedtype: string- name: refInjectiondtype: string- name: idTextedtype: 'null'- name: idTechInjectiondtype: string- name: originedtype: string- name: dateDebutExtensiondtype: int64- name: idEliAliasdtype: 'null'- name: cidTextedtype: 'null'- name: sectionParentIddtype: string- name: multipleVersionsdtype: bool- name: comporteLiensSPdtype: bool- name: sectionParentTitredtype: string- name: infosRestructurationBranchedtype: 'null'- name: idElidtype: 'null'- name: sectionParentCiddtype: string- name: numeroBodtype: 'null'- name: infosRestructurationBrancheHtmldtype: 'null'- name: historiquedtype: 'null'- name: infosComplementairesHtmldtype: 'null'- name: renvoidtype: 'null'- name: fullSectionsTitredtype: string- name: notaHtmldtype: string- name: inapdtype: 'null'splits:- name: trainnum_bytes: 21046723num_examples: 7248download_size: 6328254dataset_size: 21046723---# Code de commerce, non-instruct (2024-08-13)This project focuses on fine-tuning pre-trained language models to create efficient and accurate models for legal practice.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.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.Instruction-based fine-tuning significantly enhances the performance of LLMs in the following ways:- 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.- 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.- 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.- 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.- 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.## Concurrent reading of the LegalKitTo use all the legal data published on LegalKit, you can use this code snippet:```python# -*- coding: utf-8 -*-import concurrent.futuresimport osimport datasetsfrom tqdm.notebook import tqdmdef dataset_loader(name:str,streaming:bool=True) -> datasets.Dataset:"""Helper function to load a single dataset in parallel.Parameters----------name : strName of the dataset to be loaded.streaming : bool, optionalDetermines if datasets are streamed. Default is True.Returns-------dataset : datasets.DatasetLoaded dataset object.Raises------ExceptionIf an error occurs during dataset loading."""try:return datasets.load_dataset(name,split="train",streaming=streaming)except Exception as exc:logging.error(f"Error loading dataset {name}: {exc}")return Nonedef load_datasets(req:list,streaming:bool=True) -> list:"""Downloads datasets specified in a list and creates a list of loaded datasets.Parameters----------req : listA list containing the names of datasets to be downloaded.streaming : bool, optionalDetermines if datasets are streamed. Default is True.Returns-------datasets_list : listA list containing loaded datasets as per the requested names provided in 'req'.Raises------ExceptionIf an error occurs during dataset loading or processing.Examples-------->>> datasets = load_datasets(["dataset1", "dataset2"], streaming=False)"""datasets_list = []with concurrent.futures.ThreadPoolExecutor() as executor:future_to_dataset = {executor.submit(dataset_loader, name): name for name in req}for future in tqdm(concurrent.futures.as_completed(future_to_dataset), total=len(req)):name = future_to_dataset[future]try:dataset = future.result()if dataset:datasets_list.append(dataset)except Exception as exc:logging.error(f"Error processing dataset {name}: {exc}")return datasets_listreq = ["louisbrulenaudet/code-artisanat",3 unmodified linesdatasets_list = load_datasets(req=req,streaming=True)dataset = datasets.concatenate_datasets(1 unmodified line)```## Dataset generationThis JSON file is a list of dictionaries, each dictionary contains the following fields:- `instruction`: `string`, presenting the instruction linked to the element.- `input`: `string`, signifying the input details for the element.- `output`: `string`, indicating the output information for the element.- `start`: `string`, the date of entry into force of the article.- `expiration`: `string`, the date of expiration of the article.- `num`: `string`, the id of the article.We used the following list of instructions for generating the dataset:```pythoninstructions = ["Compose l'intégralité de l'article sous forme écrite.","Écris la totalité du contenu de l'article.","Formule la totalité du texte présent dans l'article.","Produis l'intégralité de l'article en écriture.","Développe l'article dans son ensemble par écrit.","Génère l'ensemble du texte contenu dans l'article.","Formule le contenu intégral de l'article en entier.","Rédige la totalité du texte de l'article en entier.","Compose l'intégralité du contenu textuel de l'article.","Rédige l'ensemble du texte qui constitue l'article.","Formule l'article entier dans son contenu écrit.","Composez l'intégralité de l'article sous forme écrite.","Écrivez la totalité du contenu de l'article.","Formulez la totalité du texte présent dans l'article.","Développez l'article dans son ensemble par écrit.","Générez l'ensemble du texte contenu dans l'article.","Formulez le contenu intégral de l'article en entier.","Rédigez la totalité du texte de l'article en entier.","Composez l'intégralité du contenu textuel de l'article.","Écrivez l'article dans son intégralité en termes de texte.","Rédigez l'ensemble du texte qui constitue l'article.","Formulez l'article entier dans son contenu écrit.","Composer l'intégralité de l'article sous forme écrite.","Écrire la totalité du contenu de l'article.","Formuler la totalité du texte présent dans l'article.","Produire l'intégralité de l'article en écriture.","Développer l'article dans son ensemble par écrit.","Générer l'ensemble du texte contenu dans l'article.","Formuler le contenu intégral de l'article en entier.","Rédiger la totalité du texte de l'article en entier.","Composer l'intégralité du contenu textuel de l'article.","Rédiger l'ensemble du texte qui constitue l'article.","Formuler l'article entier dans son contenu écrit.","Quelles sont les dispositions de l'article ?","Quelles dispositions sont incluses dans l'article ?","Quelles sont les dispositions énoncées dans l'article ?","Quel est le texte intégral de l'article ?","Quelle est la lettre de l'article ?"]```## Feedback1234567891011121314151617181 unmodified line20212223242526272829303132333435363738394041424344454647483 unmodified lines525354555657581 unmodified line60616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123---license: apache-2.0language:- frmultilinguality:- monolingualtags:- finetuning- legal- french law- droit français- Code de commercesource_datasets:- originalpretty_name: Code de commercetask_categories:- text-generation- table-question-answering1 unmodified line- text-retrieval- question-answering- text-classificationsize_categories:- 1K<n<10K---# Code de commerce, non-instruct (2024-08-14)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.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.## Concurrent reading of the LegalKit[<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)To use all the legal data published on LegalKit, you can use RAGoon:```bashpip3 install ragoon```Then, you can load multiple datasets using this code snippet:```python# -*- coding: utf-8 -*-from ragoon import load_datasetsreq = ["louisbrulenaudet/code-artisanat",3 unmodified linesdatasets_list = load_datasets(req=req,streaming=False)dataset = datasets.concatenate_datasets(1 unmodified line)```### Data Structure for Article InformationThis 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.1. **Basic Information**- `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").- `texte` (string): **Text Content** - The textual content of the article.- `dateDebut` (string): **Start Date** - The date when the article came into effect.- `dateFin` (string): **End Date** - The date when the article was terminated or superseded.- `num` (string): **Article Number** - The number assigned to the article.- `id` (string): **Article ID** - Unique identifier for the article.- `cid` (string): **Chronical ID** - Chronical identifier for the article.- `type` (string): **Type** - The type or classification of the document (e.g., "AUTONOME").- `etat` (string): **Legal Status** - The current legal status of the article (e.g., "MODIFIE_MORT_NE").2. **Content and Notes**- `nota` (string): **Notes** - Additional notes or remarks associated with the article.- `version_article` (string): **Article Version** - The version number of the article.- `ordre` (integer): **Order Number** - A numerical value used to sort articles within their parent section.3. **Additional Metadata**- `conditionDiffere` (string): **Deferred Condition** - Specific conditions related to collective agreements.- `infosComplementaires` (string): **Additional Information** - Extra information pertinent to the article.- `surtitre` (string): **Subtitle** - A subtitle or additional title information related to collective agreements.- `nature` (string): **Nature** - The nature or category of the document (e.g., "Article").- `texteHtml` (string): **HTML Content** - The article's content in HTML format.4. **Versioning and Extensions**- `dateFinExtension` (string): **End Date of Extension** - The end date if the article has an extension.- `versionPrecedente` (string): **Previous Version** - Identifier for the previous version of the article.- `refInjection` (string): **Injection Reference** - Technical reference to identify the date of injection.- `idTexte` (string): **Text ID** - Identifier for the legal text to which the article belongs.- `idTechInjection` (string): **Technical Injection ID** - Technical identifier for the injected element.5. **Origin and Relationships**- `origine` (string): **Origin** - The origin of the document (e.g., "LEGI").- `dateDebutExtension` (string): **Start Date of Extension** - The start date if the article has an extension.- `idEliAlias` (string): **ELI Alias** - Alias for the European Legislation Identifier (ELI).- `cidTexte` (string): **Text Chronical ID** - Chronical identifier of the text.6. **Hierarchical Relationships**- `sectionParentId` (string): **Parent Section ID** - Technical identifier of the parent section.- `multipleVersions` (boolean): **Multiple Versions** - Indicates if the article has multiple versions.- `comporteLiensSP` (boolean): **Contains Public Service Links** - Indicates if the article contains links to public services.- `sectionParentTitre` (string): **Parent Section Title** - Title of the parent section (e.g., "I : Revenu imposable").- `infosRestructurationBranche` (string): **Branch Restructuring Information** - Information about branch restructuring.- `idEli` (string): **ELI ID** - European Legislation Identifier (ELI) for the article.- `sectionParentCid` (string): **Parent Section Chronical ID** - Chronical identifier of the parent section.7. **Additional Content and History**- `numeroBo` (string): **Official Bulletin Number** - Number of the official bulletin where the article was published.- `infosRestructurationBrancheHtml` (string): **Branch Restructuring Information (HTML)** - Branch restructuring information in HTML format.- `historique` (string): **History** - Historical context or changes specific to collective agreements.- `infosComplementairesHtml` (string): **Additional Information (HTML)** - Additional information in HTML format.- `renvoi` (string): **Reference** - References to content within the article (e.g., "(1)").- `fullSectionsTitre` (string): **Full Section Titles** - Concatenation of all titles in the parent chain.- `notaHtml` (string): **Notes (HTML)** - Additional notes or remarks in HTML format.- `inap` (string): **INAP** - A placeholder for INAP-specific information.## Feedback
README.md+80-264