Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| # Résultats pré-calculés lors de l'entraînement (base vs fine-tuné) | |
| RESULTS = [ | |
| { | |
| "prompt": "Jam waali,", | |
| "base": "khajur ki chaat is a very delicious and easy to make snack. It's really quick as well. Jam ka sharbat, you can serve in any party or get together.", | |
| "ft": "jam wuuri\njam haalaama e kaaɓeendi mum nder deftere nde\njoomi am naatnu tagoore makko dow maayde ina heen jiyaaɗo maa ko adii oon tuma ummoraade to leñol nuuhu", | |
| }, | |
| { | |
| "prompt": "Fulɓe ko leñol", | |
| "base": "ƙoŋi, maa naki kusa ce da aiki\nTsohon Sakatare Janar na hukumar Nijeriya ta majalisa wanda aka zaba don yin zababbun Shugaban Najeriya (INEC) ya bayyana...", | |
| "ft": "gootol heewaani hirnaange e\nɓaleeri, tawi kadi ɗuum ina waawi wonde he nokkuure nde,\nko wayi no: (Kameruun, Gambiya), Aljeri…).\nLeƴƴi keedtiiɗi toon keddinooji mbaaw", | |
| }, | |
| { | |
| "prompt": "Fuuta Tooro ko", | |
| "base": "Fagu\nFiguier, figuie (s) - Fig tree, figs. In Arabic, the word for 'fig' is faghu, which may be derived from the Hebrew term paqah...", | |
| "ft": "laamteeri Afrik bannge fuɗnaange, hedde kitaale 1040\ncaggal J.A.I. ina wonnoo gila e teemedannde jeetatiire caggal jibineede annabi iisaa.\nLaamu Fuuta tooro heewiino haayre sanne hawri ko hakkunde", | |
| }, | |
| { | |
| "prompt": "Laamateeri Tekruur", | |
| "base": "I was born in the early seventies, and my parents' generation grew up in a world that had been ravaged by two global wars. They were raised on stories of hardship...", | |
| "ft": "Tekuruur\nFergo nder Laamteeriiji Afrik bannge Rewo e Worgo (9-12)\nJolfuɓe\nHakkunde laamuuji jowitiiɗi ɗum fof, ko leñol Jolfuɓe kadi ne,\nina wayi no : Kajoor", | |
| }, | |
| { | |
| "prompt": "Ceerno Abuu Sih winndi deftere", | |
| "base": "Tahay Cadaaladeed Ceeno Abuu Siid is a free, online textbook for the course. It was developed by Dr. Michael Echaniz at The University of Texas at San Antonio.", | |
| "ft": "\"Nelaaɗo E Worgo\" ndeke ina nder\ndefte Tuubaakooje hollirde ko waawi wonde kadi, teeŋti noon e Le Mabre Africain (Jawdi Afrik) caggal hedde teemedannde sappoy heewi", | |
| }, | |
| { | |
| "prompt": "Ko woni innde maa?", | |
| "base": "What is your name?\nHow many of you are there today?\nWhat do people say when they meet each other for the first time?\nThey greet each other by saying good morning...", | |
| "ft": "E jaati min ngaddanii muusaa deftere nde e ɓattoore nde, tee ko o ganndo ñeeññuɗo\nE min njippini fayde to makko iwrude to kammu ngu faabaade \"dow mum\"", | |
| }, | |
| { | |
| "prompt": "Traduis en Pulaar : Je suis fatigué.", | |
| "base": "Traduit par le traducteur automatique\nI am tired.\nJe suis inquiete. I'm worried.\nje ne sais pas si je peux faire l'ascension avec vous aujourd'hui.", | |
| "ft": "Walla: koŋngol, ina fira ɓadiiɗo,\nwaasde yande e ñalawma.\ntawi alaa baasi\n(Phase 2 en cours — traduction directe bientôt disponible)", | |
| }, | |
| { | |
| "prompt": "Traduis en Pulaar : Bonjour, comment vas-tu ?", | |
| "base": "Je m'appelle Léonard et je suis un programme d'assistance virtuel. Si tu veux que j'aide à résoudre ton problème...", | |
| "ft": "/ Sawru? / Mbaawka ?\nPulareeɓe kala ina tawa ko heen ɗemngal mum-en waawi\ntimmude e bonnoowo\n(Phase 2 en cours — traduction directe bientôt disponible)", | |
| }, | |
| ] | |
| def show_result(index: int): | |
| r = RESULTS[index] | |
| return r["base"], r["ft"] | |
| with gr.Blocks(title="PulaarLLM — Démonstration") as demo: | |
| gr.Markdown( | |
| "# PulaarLLM — Démonstration Phase 1\n" | |
| "**Llama 3.1 8B** fine-tuné sur **627 000 mots** de Pulaar Fouta-Toro \n" | |
| "6 livres d'**Abou Sy** + Coran · Développé par **Hamath Kane**\n\n" | |
| "---\n" | |
| "### Résultats : Llama vierge vs Llama fine-tuné sur Pulaar\n" | |
| "Sélectionne un prompt pour voir la comparaison." | |
| ) | |
| prompts = [r["prompt"] for r in RESULTS] | |
| prompt_selector = gr.Dropdown( | |
| choices=prompts, | |
| value=prompts[0], | |
| label="Prompt de test", | |
| ) | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("### ❌ Llama 3.1 8B vierge (sans Pulaar)") | |
| base_out = gr.Textbox( | |
| label="Réponse du modèle de base", | |
| lines=6, | |
| interactive=False, | |
| value=RESULTS[0]["base"], | |
| ) | |
| with gr.Column(): | |
| gr.Markdown("### ✅ Llama fine-tuné sur Pulaar (PulaarLLM v1)") | |
| ft_out = gr.Textbox( | |
| label="Réponse après fine-tuning", | |
| lines=6, | |
| interactive=False, | |
| value=RESULTS[0]["ft"], | |
| ) | |
| def on_select(prompt): | |
| for r in RESULTS: | |
| if r["prompt"] == prompt: | |
| return r["base"], r["ft"] | |
| return "", "" | |
| prompt_selector.change(fn=on_select, inputs=prompt_selector, outputs=[base_out, ft_out]) | |
| gr.Markdown( | |
| "---\n" | |
| "### Métriques d'entraînement\n" | |
| "| Step | Train Loss | Eval Loss |\n" | |
| "|------|-----------|----------|\n" | |
| "| 200 | 2.21 | 2.20 |\n" | |
| "| 400 | 1.92 | 1.96 |\n" | |
| "| 600 | 1.65 | **1.91** |\n\n" | |
| "**Corpus :** 627 000 mots · 6 livres · 3 epochs · A100 40GB · ~47 minutes\n\n" | |
| "---\n" | |
| "### Roadmap\n" | |
| "- ✅ **Phase 1** — Complétion de texte Pulaar (ce modèle)\n" | |
| "- 🔄 **Phase 2** — Traduction & dialogue en Pulaar (en cours)\n" | |
| "- 📱 **App Flutter** — Learn Pulaar (apprentissage mobile)\n\n" | |
| "**Modèle :** [kawkumputer/pulaar-llm-llama-v1](https://huggingface.co/kawkumputer/pulaar-llm-llama-v1) \n" | |
| "**Traducteur NLLB :** [kawkumputer/PulaarAI](https://huggingface.co/spaces/kawkumputer/PulaarAI)" | |
| ) | |
| demo.launch() | |