gpnd commited on
Commit
c8d626c
·
verified ·
1 Parent(s): a2df4a0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -199
README.md CHANGED
@@ -1,208 +1,122 @@
1
  ---
2
  language:
3
- - en
4
- - de
5
  - fr
6
- - it
7
- - pt
8
- - hi
9
- - es
10
- - th
11
- library_name: mlx
12
  license: llama3.2
 
13
  pipeline_tag: text-generation
14
  tags:
15
- - facebook
16
- - meta
17
- - pytorch
18
  - llama
19
  - llama-3
20
- - mlx
21
- extra_gated_prompt: "### LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\n\nLlama 3.2 Version\
22
- \ Release Date: September 25, 2024\n\n“Agreement” means the terms and conditions\
23
- \ for use, reproduction, distribution and modification of the Llama Materials set\
24
- \ forth herein.\n\n“Documentation” means the specifications, manuals and documentation\
25
- \ accompanying Llama 3.2 distributed by Meta at https://llama.meta.com/doc/overview.\n\
26
- \n“Licensee” or “you” means you, or your employer or any other person or entity\
27
- \ (if you are entering into this Agreement on such person or entity’s behalf),\
28
- \ of the age required under applicable laws, rules or regulations to provide legal\
29
- \ consent and that has legal authority to bind your employer or such other person\
30
- \ or entity if you are entering in this Agreement on their behalf.\n\n“Llama 3.2”\
31
- \ means the foundational large language models and software and algorithms, including\
32
- \ machine-learning model code, trained model weights, inference-enabling code, training-enabling\
33
- \ code, fine-tuning enabling code and other elements of the foregoing distributed\
34
- \ by Meta at https://www.llama.com/llama-downloads.\n\n“Llama Materials” means,\
35
- \ collectively, Meta’s proprietary Llama 3.2 and Documentation (and any portion\
36
- \ thereof) made available under this Agreement.\n\n“Meta” or “we” means Meta Platforms\
37
- \ Ireland Limited (if you are located in or, if you are an entity, your principal\
38
- \ place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if\
39
- \ you are located outside of the EEA or Switzerland). \n\nBy clicking “I Accept”\
40
- \ below or by using or distributing any portion or element of the Llama Materials,\
41
- \ you agree to be bound by this Agreement.\n\n1. License Rights and Redistribution.\n\
42
- a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable\
43
- \ and royalty-free limited license under Meta’s intellectual property or other rights\
44
- \ owned by Meta embodied in the Llama Materials to use, reproduce, distribute,\
45
- \ copy, create derivative works of, and make modifications to the Llama Materials.\
46
- \ \nb. Redistribution and Use. \ni. If you distribute or make available the Llama\
47
- \ Materials (or any derivative works thereof), or a product or service (including\
48
- \ another AI model) that contains any of them, you shall (A) provide a copy of this\
49
- \ Agreement with any such Llama Materials; and (B) prominently display “Built with\
50
- \ Llama” on a related website, user interface, blogpost, about page, or product\
51
- \ documentation. If you use the Llama Materials or any outputs or results of the\
52
- \ Llama Materials to create, train, fine tune, or otherwise improve an AI model,\
53
- \ which is distributed or made available, you shall also include “Llama” at the\
54
- \ beginning of any such AI model name.\nii. If you receive Llama Materials, or any\
55
- \ derivative works thereof, from a Licensee as part of an integrated end user product,\
56
- \ then Section 2 of this Agreement will not apply to you. \niii. You must retain\
57
- \ in all copies of the Llama Materials that you distribute the following attribution\
58
- \ notice within a “Notice” text file distributed as a part of such copies: “Llama\
59
- \ 3.2 is licensed under the Llama 3.2 Community License, Copyright © Meta Platforms,\
60
- \ Inc. All Rights Reserved.”\niv. Your use of the Llama Materials must comply with\
61
- \ applicable laws and regulations (including trade compliance laws and regulations)\
62
- \ and adhere to the Acceptable Use Policy for the Llama Materials (available at\
63
- \ https://www.llama.com/llama3_2/use-policy), which is hereby incorporated by reference\
64
- \ into this Agreement.\n \n2. Additional Commercial Terms. If, on the Llama 3.2\
65
- \ version release date, the monthly active users of the products or services made\
66
- \ available by or for Licensee, or Licensee’s affiliates, is greater than 700 million\
67
- \ monthly active users in the preceding calendar month, you must request a license\
68
- \ from Meta, which Meta may grant to you in its sole discretion, and you are not\
69
- \ authorized to exercise any of the rights under this Agreement unless or until\
70
- \ Meta otherwise expressly grants you such rights.\n3. Disclaimer of Warranty. UNLESS\
71
- \ REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM\
72
- \ ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS\
73
- \ ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION,\
74
- \ ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR\
75
- \ PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING\
76
- \ OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR\
77
- \ USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.\n4. Limitation of Liability.\
78
- \ IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY,\
79
- \ WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING\
80
- \ OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL,\
81
- \ INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE\
82
- \ BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.\n5. Intellectual Property.\n\
83
- a. No trademark licenses are granted under this Agreement, and in connection with\
84
- \ the Llama Materials, neither Meta nor Licensee may use any name or mark owned\
85
- \ by or associated with the other or any of its affiliates, except as required\
86
- \ for reasonable and customary use in describing and redistributing the Llama Materials\
87
- \ or as set forth in this Section 5(a). Meta hereby grants you a license to use\
88
- \ “Llama” (the “Mark”) solely as required to comply with the last sentence of Section\
89
- \ 1.b.i. You will comply with Meta’s brand guidelines (currently accessible at\
90
- \ https://about.meta.com/brand/resources/meta/company-brand/). All goodwill arising\
91
- \ out of your use of the Mark will inure to the benefit of Meta.\nb. Subject to\
92
- \ Meta’s ownership of Llama Materials and derivatives made by or for Meta, with\
93
- \ respect to any derivative works and modifications of the Llama Materials that\
94
- \ are made by you, as between you and Meta, you are and will be the owner of such\
95
- \ derivative works and modifications.\nc. If you institute litigation or other proceedings\
96
- \ against Meta or any entity (including a cross-claim or counterclaim in a lawsuit)\
97
- \ alleging that the Llama Materials or Llama 3.2 outputs or results, or any portion\
98
- \ of any of the foregoing, constitutes infringement of intellectual property or\
99
- \ other rights owned or licensable by you, then any licenses granted to you under\
100
- \ this Agreement shall terminate as of the date such litigation or claim is filed\
101
- \ or instituted. You will indemnify and hold harmless Meta from and against any\
102
- \ claim by any third party arising out of or related to your use or distribution\
103
- \ of the Llama Materials.\n6. Term and Termination. The term of this Agreement will\
104
- \ commence upon your acceptance of this Agreement or access to the Llama Materials\
105
- \ and will continue in full force and effect until terminated in accordance with\
106
- \ the terms and conditions herein. Meta may terminate this Agreement if you are\
107
- \ in breach of any term or condition of this Agreement. Upon termination of this\
108
- \ Agreement, you shall delete and cease use of the Llama Materials. Sections 3,\
109
- \ 4 and 7 shall survive the termination of this Agreement. \n7. Governing Law and\
110
- \ Jurisdiction. This Agreement will be governed and construed under the laws of\
111
- \ the State of California without regard to choice of law principles, and the UN\
112
- \ Convention on Contracts for the International Sale of Goods does not apply to\
113
- \ this Agreement. The courts of California shall have exclusive jurisdiction of\
114
- \ any dispute arising out of this Agreement. \n### Llama 3.2 Acceptable Use Policy\n\
115
- Meta is committed to promoting safe and fair use of its tools and features, including\
116
- \ Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use Policy\
117
- \ (“**Policy**”). The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\n\
118
- #### Prohibited Uses\nWe want everyone to use Llama 3.2 safely and responsibly.\
119
- \ You agree you will not use, or allow others to use, Llama 3.2 to:\n1. Violate\
120
- \ the law or others’ rights, including to:\n 1. Engage in, promote, generate,\
121
- \ contribute to, encourage, plan, incite, or further illegal or unlawful activity\
122
- \ or content, such as:\n 1. Violence or terrorism\n 2. Exploitation\
123
- \ or harm to children, including the solicitation, creation, acquisition, or dissemination\
124
- \ of child exploitative content or failure to report Child Sexual Abuse Material\n\
125
- \ 3. Human trafficking, exploitation, and sexual violence\n 4. The\
126
- \ illegal distribution of information or materials to minors, including obscene\
127
- \ materials, or failure to employ legally required age-gating in connection with\
128
- \ such information or materials.\n 5. Sexual solicitation\n 6. Any\
129
- \ other criminal activity\n 1. Engage in, promote, incite, or facilitate the\
130
- \ harassment, abuse, threatening, or bullying of individuals or groups of individuals\n\
131
- \ 2. Engage in, promote, incite, or facilitate discrimination or other unlawful\
132
- \ or harmful conduct in the provision of employment, employment benefits, credit,\
133
- \ housing, other economic benefits, or other essential goods and services\n 3.\
134
- \ Engage in the unauthorized or unlicensed practice of any profession including,\
135
- \ but not limited to, financial, legal, medical/health, or related professional\
136
- \ practices\n 4. Collect, process, disclose, generate, or infer private or sensitive\
137
- \ information about individuals, including information about individuals’ identity,\
138
- \ health, or demographic information, unless you have obtained the right to do so\
139
- \ in accordance with applicable law\n 5. Engage in or facilitate any action or\
140
- \ generate any content that infringes, misappropriates, or otherwise violates any\
141
- \ third-party rights, including the outputs or results of any products or services\
142
- \ using the Llama Materials\n 6. Create, generate, or facilitate the creation\
143
- \ of malicious code, malware, computer viruses or do anything else that could disable,\
144
- \ overburden, interfere with or impair the proper working, integrity, operation\
145
- \ or appearance of a website or computer system\n 7. Engage in any action, or\
146
- \ facilitate any action, to intentionally circumvent or remove usage restrictions\
147
- \ or other safety measures, or to enable functionality disabled by Meta \n2. Engage\
148
- \ in, promote, incite, facilitate, or assist in the planning or development of activities\
149
- \ that present a risk of death or bodily harm to individuals, including use of Llama\
150
- \ 3.2 related to the following:\n 8. Military, warfare, nuclear industries or\
151
- \ applications, espionage, use for materials or activities that are subject to the\
152
- \ International Traffic Arms Regulations (ITAR) maintained by the United States\
153
- \ Department of State or to the U.S. Biological Weapons Anti-Terrorism Act of 1989\
154
- \ or the Chemical Weapons Convention Implementation Act of 1997\n 9. Guns and\
155
- \ illegal weapons (including weapon development)\n 10. Illegal drugs and regulated/controlled\
156
- \ substances\n 11. Operation of critical infrastructure, transportation technologies,\
157
- \ or heavy machinery\n 12. Self-harm or harm to others, including suicide, cutting,\
158
- \ and eating disorders\n 13. Any content intended to incite or promote violence,\
159
- \ abuse, or any infliction of bodily harm to an individual\n3. Intentionally deceive\
160
- \ or mislead others, including use of Llama 3.2 related to the following:\n 14.\
161
- \ Generating, promoting, or furthering fraud or the creation or promotion of disinformation\n\
162
- \ 15. Generating, promoting, or furthering defamatory content, including the\
163
- \ creation of defamatory statements, images, or other content\n 16. Generating,\
164
- \ promoting, or further distributing spam\n 17. Impersonating another individual\
165
- \ without consent, authorization, or legal right\n 18. Representing that the\
166
- \ use of Llama 3.2 or outputs are human-generated\n 19. Generating or facilitating\
167
- \ false online engagement, including fake reviews and other means of fake online\
168
- \ engagement \n4. Fail to appropriately disclose to end users any known dangers\
169
- \ of your AI system 5. Interact with third party tools, models, or software designed\
170
- \ to generate unlawful content or engage in unlawful or harmful conduct and/or represent\
171
- \ that the outputs of such tools, models, or software are associated with Meta or\
172
- \ Llama 3.2\n\nWith respect to any multimodal models included in Llama 3.2, the\
173
- \ rights granted under Section 1(a) of the Llama 3.2 Community License Agreement\
174
- \ are not being granted to you if you are an individual domiciled in, or a company\
175
- \ with a principal place of business in, the European Union. This restriction does\
176
- \ not apply to end users of a product or service that incorporates any such multimodal\
177
- \ models.\n\nPlease report any violation of this Policy, software “bug,” or other\
178
- \ problems that could lead to a violation of this Policy through one of the following\
179
- \ means:\n\n* Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues&h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\n\
180
- * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\n\
181
- * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\n\
182
- * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama\
183
- \ 3.2: LlamaUseReport@meta.com"
184
- extra_gated_fields:
185
- First Name: text
186
- Last Name: text
187
- Date of birth: date_picker
188
- Country: country
189
- Affiliation: text
190
- Job title:
191
- type: select
192
- options:
193
- - Student
194
- - Research Graduate
195
- - AI researcher
196
- - AI developer/engineer
197
- - Reporter
198
- - Other
199
- geo: ip_location
200
- ? By clicking Submit below I accept the terms of the license and acknowledge that
201
- the information I provide will be collected stored processed and shared in accordance
202
- with the Meta Privacy Policy
203
- : checkbox
204
- extra_gated_description: The information you provide will be collected, stored, processed
205
- and shared in accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/).
206
- extra_gated_button_content: Submit
207
- base_model: mlx-community/Llama-3.2-3B-Instruct-bf16
208
  ---
 
 
 
 
 
1
  ---
2
  language:
 
 
3
  - fr
 
 
 
 
 
 
4
  license: llama3.2
5
+ base_model: mlx-community/Llama-3.2-3B-Instruct-bf16
6
  pipeline_tag: text-generation
7
  tags:
 
 
 
8
  - llama
9
  - llama-3
10
+ - french
11
+ - FALC
12
+ - accessibility
13
+ - text-simplification
14
+ - fine-tuned
15
+ - QLoRA
16
+ ---
17
+
18
+ # llama-falc Simplification de textes administratifs en FALC 🇫🇷
19
+
20
+ **llama-falc** est un modèle fine-tuné à partir de [Llama 3.2 3B Instruct](https://huggingface.co/mlx-community/Llama-3.2-3B-Instruct-bf16), entraîné sur des paires de textes administratifs français ↔ versions FALC (Facile À Lire et à Comprendre).
21
+
22
+ > ⚠️ **Note honnête** : les résultats de ce modèle sont décevants. Ce repository documente un projet d'apprentissage complet, incluant les échecs et les décisions prises en cours de route. Le détail est dans la section [Retour d'expérience](#retour-dexpérience).
23
+
24
+ ---
25
+
26
+ ## À propos du FALC
27
+
28
+ Le FALC est une méthode normée de simplification du langage, définie par 53 règles européennes (guide Unapei), visant à rendre l'information accessible aux personnes en situation de handicap cognitif, d'illettrisme ou non-francophones. Obligation légale pour le service public français depuis 2005.
29
+
30
+ ---
31
+
32
+ ## Utilisation
33
+
34
+ ```python
35
+ from mlx_lm import load, generate
36
+
37
+ model, tokenizer = load("gpnd/llama-falc")
38
+
39
+ texte_source = "Dans le cadre de la mise en œuvre des dispositions réglementaires relatives à l'attribution des prestations sociales, il convient de constituer un dossier de demande auprès des services compétents."
40
+
41
+ prompt = f"[INST] Transforme ce texte administratif en FALC.\n\nTexte :\n{texte_source} [/INST]"
42
+ response = generate(model, tokenizer, prompt=prompt, max_tokens=512)
43
+ print(response)
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Méthodologie & pipeline
49
+
50
+ ### 1. Collecte des données (Firecrawl + scraping)
51
+
52
+ L'objectif initial était de constituer un dataset de paires alignées `{texte administratif version FALC}` à partir de sites gouvernementaux français.
53
+
54
+ Un bot de scraping a été construit avec Firecrawl, en utilisant la fonction `map` pour identifier des sites proposant une version FALC et une version standard en HTML. **22 pages ont été détectées**, chacune avec sa contrepartie.
55
+
56
+ Problème rencontré : 22 pages entières (x2) dépassent la fenêtre de contexte du LLM utilisé pour l'alignement. Le contenu a dû être fractionné en éléments plus petits avant traitement.
57
+
58
+ ### 2. Construction du dataset (Python + Claude Sonnet 4.5)
59
+
60
+ Un script Python a été développé pour transformer les 22 pages en paires exploitables pour le fine-tuning. Claude Sonnet 4.5 a été utilisé comme modèle d'alignement.
61
+
62
+ **Problème principal** : la qualité des paires générées s'est révélée insuffisante. Les correspondances entre textes sources et versions FALC manquaient de précision — une correspondance thématique n'est pas une correspondance d'alignement. Même après amélioration du code Python pour affiner les paires, la qualité est restée limitée.
63
+
64
+ **Insight clé** : la rareté des paires gold strictement alignées sur internet est le vrai verrou du problème. La plupart des pages FALC en ligne sont des adaptations thématiques, pas des traductions directes d'un texte source identifiable.
65
+
66
+ ### 3. Fine-tuning (MLX + Apple Silicon)
67
+
68
+ Plusieurs environnements ont été testés avant de trouver une configuration fonctionnelle :
69
+
70
+ | Environnement | Résultat |
71
+ |---|---|
72
+ | AutoTrain HuggingFace | Fonctionnalité supprimée |
73
+ | Google Colab (GPU T4) | Échec de configuration |
74
+ | VSCode + kernel GPU T4 | Échec de configuration |
75
+ | **VSCode + MLX (Apple Silicon)** | Fonctionnel |
76
+
77
+ Le modèle retenu est **Llama 3.2 3B Instruct (bf16)** choix guidé par les contraintes matérielles (Apple Silicon, MLX framework) plutôt que par une évaluation comparative.
78
+
79
+ ### 4. Résultats
80
+
81
+ Les outputs du modèle fine-tuné sont de mauvaise qualité. Le modèle ne produit pas de textes FALC conformes aux règles européennes.
82
+
83
+ **Hypothèses sur les causes d'échec :**
84
+ - Dataset insuffisant en volume (~22 paires) et en qualité d'alignement
85
+ - Modèle de base trop petit (3B paramètres) pour une tâche de transformation stylistique aussi contrainte
86
+ - Absence de filtre qualité sur les données d'entraînement (pas de rule checker implémenté avant entraînement)
87
+
88
+ ---
89
+
90
+ ## Retour d'expérience
91
+
92
+ Ce projet est documenté tel quel, y compris l'échec, parce que le processus a de la valeur indépendamment du résultat :
93
+
94
+ - **Pipeline ML end-to-end réalisé** : collecte alignement fine-tuning évaluation
95
+ - **Verrou identifié sur les données FALC** : le problème n'est pas le modèle, c'est la rareté des paires gold strictement alignées en français
96
+ - **Leçon sur le fine-tuning** : la qualité du dataset prime sur tout le reste — entraîner sur 22 paires mal alignées produit un modèle qui apprend du bruit
97
+ - **Connaissance du stack** : MLX, QLoRA, format d'instruction Llama, pipeline de scraping Firecrawl
98
+
99
+ Une V2 défendable nécessiterait : 50+ paires gold validées manuellement + filtre qualité automatique (rule checker Python) avant entraînement + modèle de base plus grand (7B minimum).
100
+
101
+ ---
102
+
103
+ ## Stack technique
104
+
105
+ - **Fine-tuning** : MLX (Apple Silicon), QLoRA
106
+ - **Scraping** : Firecrawl (fonction `map`)
107
+ - **Alignement des paires** : Claude Sonnet 4.5
108
+ - **Modèle de base** : Llama 3.2 3B Instruct bf16
109
+
110
+ ---
111
+
112
+ ## Références
113
+
114
+ - [Guide FALC Unapei Les 53 règles européennes](https://www.unapei.org/wp-content/uploads/2018/11/L%E2%80%99information-pour-tous-Re%CC%80gles-europe%CC%81ennes-pour-une-information-facile-a%CC%80-lire-et-a%CC%80-comprendre.pdf)
115
+ - [QLoRA: Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314)
116
+ - [MLX Apple Machine Learning framework](https://github.com/ml-explore/mlx)
117
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ---
119
+
120
+ ## Auteur
121
+
122
+ [gpnd](https://huggingface.co/gpnd) — PM IA, projet portfolio d'apprentissage du cycle ML complet.