Update README.md
Browse files
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 |
-
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 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.
|