Spaces:
Sleeping
Sleeping
Broulaye Doumbia commited on
Commit ·
da3a060
1
Parent(s): 76aac1b
fix read me
Browse filesFiles changed (4)
12 unmodified lines131415161718192021222324252627282930313233343536373839404142434445464748495012 unmodified lines- bambara- fula- speech-recognition- language-learning- west-africa- low-resource-nlp- memory---# 🌍 Sahel-Voice-Lab — Internal Edition**Phase 1 · The Memory Loop**A self-learning voice assistant for Bambara and Fula. Teach it words — it remembers them forever.## Stack (100% non-Meta)| Component | Model ||-----------|-------|| STT | `openai/whisper-large-v3-turbo` || LLM | `Qwen/Qwen2.5-72B-Instruct` (set `LLM_MODEL_ID` env var to override) || TTS | Waxal — Phase 2 || Memory | HF Dataset `vocabulary.jsonl` |## How it works1. Press Push-to-Talk → speak in Bambara, Fula, French, or English2. Whisper transcribes your speech3. Gemma reads the vocabulary it has learned so far, then:- **Teaching mode**: detects "X means Y" → saves the word pair to the Hub- **Question mode**: answers using vocabulary as source of truth- **Conversation mode**: replies naturally4. The last 5 learned words are always visible## Space secrets required| Key | Value ||-----|-------|| `HF_TOKEN` | Your HF write-access token || `FEEDBACK_REPO_ID` | `ous-sow/sahel-agri-feedback` || `LLM_MODEL_ID` | `Qwen/Qwen2.5-72B-Instruct` (or any HF Serverless-supported model) |12 unmodified lines13141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227312 unmodified lines- bambara- fula- speech-recognition- text-to-speech- agriculture- iot- language-learning- west-africa- low-resource-nlp- memory---# 🌍 Sahel-Voice-Lab**A voice-first AI assistant for Bambara (Mali) and Fula/Pular (Guinea, Senegal).**Two intertwined jobs:1. **Memory loop** — users *teach* the assistant new words; it persists them to a HuggingFace dataset and uses them as the source of truth in future answers.2. **Agricultural IoT voice interface** — Sahelian farmers query soil, weather, irrigation, and pest data in their own language, short answers, ≤ 6 words per sentence for clean TTS.The core stack is explicitly **100% non-Meta** (Whisper / Qwen / F5-TTS / VITS); MMS-TTS is only used as a baseline fallback.---## Status| Phase | Feature | State ||------:|---------|-------|| 1 | Memory loop (JSONL + HF Hub) | ✅ shipped || 2 | Waxal VITS TTS — Bambara | ✅ shipped || 2 | Waxal VITS TTS — Fula | ⏳ placeholder until `ous-sow/fula-tts` is trained || 3 | Voice-to-voice S2S (F5-TTS + CER) | 🚧 merged, stabilizing || — | Adlam ↔ Latin round-trip, per-language prompts | ✅ landed |See `docs/roadmap_2026-04.md` for the full plan and `docs/baseline_rebuild.md` for the parallel minimal-track strategy.---## Stack| Layer | Tool ||-------|------|| STT | `openai/whisper-large-v3-turbo` + PEFT LoRA hot-swap (~50 MB adapter per language, ~50 ms switch) || LLM | `Qwen/Qwen2.5-7B-Instruct` (prod default) via HF Serverless InferenceClient — overridable to `Qwen2.5-72B-Instruct`, Mistral, Zephyr || TTS (baseline) | `facebook/mms-tts-bam`, `facebook/mms-tts-ful` || TTS (Bambara) | `ynnov/ekodi-bambara-tts-female` (Waxal VITS) || TTS (Fula) | placeholder → `ous-sow/fula-tts` when published || Voice cloning | F5-TTS + OpenVoice V2 (Phase 3, GPU-only) || Speaker ID | SpeechBrain ECAPA-TDNN, 192-d embeddings, cosine ≥ 0.75 || Fast path | RapidFuzz over `data/phrases/{lang}.json` for greetings / thanks / farewells || Persistence | JSONL on disk + HF Hub datasets (no ORM) || Training | PEFT LoRA + `Seq2SeqTrainer` on FLEURS, Jeli-ASR, SLR 105/106 |---## Three entry points (do not conflate)| File | Purpose | Lifecycle ||------|---------|-----------|| `app.py` | **Production Gradio UI** on HF Spaces. Single-file (~99 KB) by design. Tabs: Conversation / Teaching / Knowledge Base / Self-Teaching. | `python app.py` || `app_lab.py` | **Experimental Gradio UI** for prototyping (e.g. `CuriosityEngine`) before folding into `app.py`. | `python app_lab.py` || `src/api/app.py` | **FastAPI service** — loads Whisper once, registers `bam`/`ful` adapters via `AdapterManager`, preloads `bam`, attaches `Transcriber` + `SensorBridge` to `app.state`. | `python scripts/run_server.py` |---## Repository layout```app.py # Gradio (production, HF Spaces)app_lab.py # Gradio (experimental)requirements.txt # Spaces runtime — do NOT pin torch/torchaudiopackages.txt # apt deps (ffmpeg)configs/base_config.yaml # shared settingsapi_config.yaml # FastAPI-specificlora_bambara.yaml # Bambara LoRA hyperparamslora_fula.yaml # Fula LoRA hyperparamsdata/phrases/ # RapidFuzz shortcut phrase JSONs per languagevocabulary.jsonl # local mirror of the HF Hub memory datasetdocs/roadmap_2026-04.md # full architectural walkthrough + action planbaseline_rebuild.md # parallel minimal-track plan (non-destructive)notebook_collaboration.md # Kaggle push/pull workflow for contributorskaggle_mcp_setup.md # optional Kaggle MCP for Claude Desktopnotebooks/kaggle_master_trainer/ # -> oussow/kaggle-master-trainer (LoRA fine-tune)train_fula_tts/ # -> oussow/sahel-voice-fula-tts-trainer (TBD)bootstrap_repos.ipynbtrain_colab.ipynb # legacy Colab trainerscripts/train_bambara.py # LoRA fine-tune entrypoint (Kaggle/RunPod)train_fula.py # LoRA fine-tune entrypoint (Kaggle/RunPod)export_onnx.py # merge LoRA -> ONNX -> TFLiteverify_baseline.py # eval harnessrun_server.py # FastAPI launcherrun_data_pipeline.py # dataset preppush_to_hf.sh # deploy helperspush_to_kaggle.sh # deploy helpersrunpod_setup.shsrc/api/ # FastAPI app, schemas, routes, middlewareconversation/ # memory_manager, gemma_client, phrase_matcher, intent_parserdata/ # dataset loading + normalization (Adlam, Bambara)engine/ # adapter_manager, transcriber, stt_processor, curiosityiot/ # intent_parser, voice_responder, sensor_bridgellm/ # LLM client wrappersmemory/ # vocabulary persistenceoptimization/ # ONNX / quantization helperstraining/ # trainer, callbacks, augmenterstts/ # mms_tts, waxal_tts, f5_tts, voice_clonervoice/ # speaker_profiles (ECAPA-TDNN + OpenVoice SE)tests/ # pytest — api, data pipeline, engine, iot```---## How the memory loop works1. Press **Push-to-Talk** → speak in Bambara, Fula, French, or English.2. **Whisper** transcribes. If the language has a LoRA adapter loaded, `AdapterManager` hot-swaps to it (~50 ms).3. **Qwen** reads the vocabulary it has learned so far (`MemoryManager.get_vocabulary_context()`), then returns a structured JSON reply with `intent ∈ {teaching, question, conversation, error}`.4. If `teaching`: the word pair is appended to `data/vocabulary.jsonl` and async-pushed to `ous-sow/sahel-agri-feedback → vocabulary.jsonl`.5. If `question`: Qwen answers using the remembered vocabulary as source of truth.6. If `conversation`: Qwen replies naturally.7. TTS speaks the reply (Waxal VITS for Bambara, MMS-TTS fallback elsewhere).The last 5 learned words are always visible in the UI.---## How the agricultural voice interface works1. User asks, e.g., *"A bɛ di wa?"* ("Is it OK?") referring to their field.2. `intent_parser.py` (keyword-based) classifies the request: `check_soil` / `check_weather` / `irrigation_status` / `pest_alert` / etc.3. `SensorBridge` calls the configured `SENSOR_API_URL` and returns a typed `SensorData`.4. `voice_responder.py` maps `(Intent, SensorData)` → a short (≤ 6 words/sentence) Bambara or Fula reply + English translation. Alert thresholds are encoded here (`SOIL_MOISTURE_LOW=30`, `TEMP_HIGH=38`, pH bounds).5. TTS speaks the reply.---## Environment variablesAll variables have sensible defaults, so you can boot the Space without any of them — but without `HF_TOKEN` the memory loop cannot push.### Core| Key | Default | Purpose ||-----|---------|---------|| `HF_TOKEN` | — | HF write token. Required for Hub push and gated models. || `FEEDBACK_REPO_ID` | `ous-sow/sahel-agri-feedback` | Memory-loop target dataset. || `ADAPTER_REPO_ID` | `ous-sow/sahel-agri-adapters` | Published LoRA adapters. || `WHISPER_MODEL_ID` | `openai/whisper-large-v3-turbo` | STT base model. || `LLM_MODEL_ID` | `Qwen/Qwen2.5-7B-Instruct` | LLM via HF Serverless. || `LOG_LEVEL` | `INFO` | Standard Python logging level. || `DEVICE` | `cuda` (FastAPI) | Torch device for inference. |### Adapters & TTS| Key | Default ||-----|---------|| `BAMBARA_ADAPTER_PATH` | `./adapters/bambara` || `FULA_ADAPTER_PATH` | `./adapters/fula` || `BAMBARA_TTS_REPO` | `ynnov/ekodi-bambara-tts-female` || `FULA_TTS_REPO` | `ous-sow/fula-tts` |### IoT| Key | Default ||-----|---------|| `SENSOR_API_URL` | *(unset → mock sensor)* |### Self-Teaching tab (triggers Kaggle training runs)| Key | Default ||-----|---------|| `KAGGLE_USERNAME` | — || `KAGGLE_KEY` | — || `KAGGLE_KERNEL_SLUG` | `ous-sow/sahel-voice-master-trainer` *(override in prod to `oussow/kaggle-master-trainer` — the actual Kaggle owner slug)* || `AUTO_TRAIN_THRESHOLD` | `50` |---## Run locally```bash# Gradio production UIpip install -r requirements.txtpython app.py# FastAPI servicepython scripts/run_server.py# Experimental lab UIpython app_lab.py```System-level dependency: **ffmpeg** (see `packages.txt`).---## TrainingLoRA fine-tuning runs on **Kaggle T4** or **RunPod** — not locally. Pick one entrypoint:| Target | Script | Notebook ||--------|--------|----------|| Bambara LoRA | `scripts/train_bambara.py` | `notebooks/kaggle_master_trainer/` || Fula LoRA | `scripts/train_fula.py` | `notebooks/kaggle_master_trainer/` || Fula TTS | — | `notebooks/train_fula_tts/` *(planned)* |**Contributor workflow:** edit notebooks locally in `notebooks/<slug>/`, commit with `nbstripout` keeping diffs clean, then `cd notebooks/<slug> && kaggle kernels push` to run on Kaggle GPU. Full walkthrough in `docs/notebook_collaboration.md`.`docs/kaggle_mcp_setup.md` documents the optional Kaggle MCP for Claude Desktop if you'd rather drive Kaggle from an LLM.---## Export for edge```bashpython scripts/export_onnx.py # merges LoRA into the backbone, exports ONNX# then onnx-tf → TFLite for Android```ONNX does not support LoRA hot-swap, so export one file per language. `bitsandbytes` NF4 / 8-bit quantization is available for GPU-constrained deploys but is a training-only dep (not in `requirements.txt`).---## Tests```bashpytest tests/```Covers: FastAPI routes, data pipeline, engine (adapter manager + transcriber), IoT (intent parser + voice responder).---## Space secrets (HF UI → Settings → Secrets)At minimum:| Key | Value ||-----|-------|| `HF_TOKEN` | write-scope token || `FEEDBACK_REPO_ID` | `ous-sow/sahel-agri-feedback` || `LLM_MODEL_ID` | `Qwen/Qwen2.5-7B-Instruct` (or any HF Serverless-supported model) |---## Design constraints (deliberate — do not change without discussion)- **Adapter hot-swap** via PEFT's multi-adapter API — one backbone in VRAM, ~50 MB adapters per language, `set_adapter` ≈ 50 ms.- **Qwen "adult-child" JSON contract** — structured `intent`/`reply`/`english`/`teaching_pair` output, parsed out of optional markdown fences.- **JSONL + Hub push memory** — no ORM, thread-safe `MemoryManager`, async push so UI never blocks.- **≤ 6 words per sentence** in `voice_responder.py` for clean MMS-TTS.- **Adlam ↔ Latin dual-script** handling in `adlam.py` + `bam_normalize.py`.- **Single-file `app.py`** — intentional for now; do not split without a plan.---## LicenseMIT.
26 unmodified lines2728293031323320 unmodified lines545556575859606 unmodified lines676869707172737475767778798081828384858687889 unmodified lines98991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631645 unmodified lines17017117217317417517617717817918018118218318418518618718851 unmodified lines24024124224324424524620 unmodified lines26726826927027127227327427527627727827928028128228328428528628728828929029129229316 unmodified lines31031131231331431531635 unmodified lines35235335435535635735864 unmodified lines42342442542642742842960 unmodified lines49049149249349449549635 unmodified lines5325335345355365375385 unmodified lines54454554654754854955088 unmodified lines63964064164264364464567 unmodified lines71371471571671771871988 unmodified lines80880981081181281381456 unmodified lines8718728738748758768778 unmodified lines88688788888989089189254 unmodified lines94794894995095195295382 unmodified lines10361037103810391040104110427 unmodified lines105010511052105310541055105651 unmodified lines110811091110111111121113111430 unmodified lines11451146114711481149115011517 unmodified lines115911601161116211631164116529 unmodified lines11951196119711981199120012019 unmodified lines121112121213121412151216121730 unmodified lines124812491250125112521253125437 unmodified lines129212931294129512961297129838 unmodified lines1337133813391340134113425 unmodified lines1348134913501351135226 unmodified lines{"cell_type": "code","execution_count": null,"id": "1","metadata": {},"outputs": [],"source": [20 unmodified lines{"cell_type": "code","execution_count": null,"id": "2","metadata": {},"outputs": [],"source": [6 unmodified lines" sys.executable, '-m', 'pip', 'install', '-q', 'jiwer==3.0.4',\n","])\n","\n","# datasets >= 4.0 uses torchcodec for audio decoding. Install if missing.\n","try:\n"," import torchcodec # noqa\n","except ImportError:\n"," print('torchcodec not found — installing to match torch ...')\n"," try:\n"," subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-q', 'torchcodec'])\n"," except subprocess.CalledProcessError:\n"," import torch as _t\n"," _tv = _t.__version__.split('+')[0]\n"," _pin = {'2.4': '0.1.*', '2.5': '0.2.*', '2.6': '0.3.*', '2.7': '0.4.*', '2.8': '0.4.*'}.get(_tv[:3])\n"," if _pin:\n"," subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-q', f'torchcodec=={_pin}'])\n"," else:\n"," print(f'⚠️ Unknown torch {_tv}; install torchcodec manually if audio decoding fails')\n","\n","import torch\n","print(f\"torch : {torch.__version__}\")\n","print(f\"CUDA avail : {torch.cuda.is_available()}\")\n",9 unmodified lines{"cell_type": "code","execution_count": null,"id": "3","metadata": {},"outputs": [],"source": ["# ── Cell 3: CONFIGURATION — edit these before each run ───────────────────────\n","import os\n","from pathlib import Path\n","\n","# ─── Environment detection (Kaggle / Colab / RunPod / local) ─────────────────\n","if Path('/kaggle/working').exists():\n"," _ENV = 'kaggle'\n"," WORKING_DIR = '/kaggle/working'\n","elif Path('/content').exists() and not Path('/workspace').exists():\n"," _ENV = 'colab'\n"," WORKING_DIR = '/content'\n","elif Path('/workspace').exists():\n"," _ENV = 'runpod'\n"," WORKING_DIR = '/workspace'\n","else:\n"," _ENV = 'local'\n"," WORKING_DIR = os.environ.get('WORKING_DIR', os.path.expanduser('~/sahel-voice-work'))\n"," Path(WORKING_DIR).mkdir(parents=True, exist_ok=True)\n","\n","# ─── Language to train ───────────────────────────────────────────────────────\n","# 'bam' = Bambara 'ful' = Fula\n","TRAIN_LANG = os.environ.get('TRAIN_LANG', 'ful')\n","\n","# ─── Model ───────────────────────────────────────────────────────────────────\n","# whisper-large-v3-turbo (128 mel bins) matches the Space base model.\n","# On T4 (Kaggle, 16 GB) drop to 'openai/whisper-small' — turbo is tight there.\n","_DEFAULT_MODEL = 'openai/whisper-small' if _ENV == 'kaggle' else 'openai/whisper-large-v3-turbo'\n","WHISPER_MODEL_ID = os.environ.get('WHISPER_MODEL_ID', _DEFAULT_MODEL)\n","TARGET_SR = 16_000\n","\n","# ─── HuggingFace repos ───────────────────────────────────────────────────────\n","HF_USERNAME = os.environ.get('HF_USERNAME', 'ous-sow')\n","FEEDBACK_REPO_ID = f'{HF_USERNAME}/sahel-agri-feedback'\n","ADAPTER_REPO_ID = f'{HF_USERNAME}/sahel-agri-adapters'\n","\n","# ─── Training hyper-parameters (defaults tuned per environment) ──────────────\n","if _ENV == 'runpod':\n"," # 24 GB RTX 3090 / A40: turbo-v3 fits with batch 8, grad_accum 4 (eff. 32)\n"," MAX_STEPS = 2_000\n"," BATCH_SIZE = 8\n"," GRAD_ACCUM = 4\n"," MAX_WAXAL_TRAIN = 5_000\n","else:\n"," # T4 (Kaggle free) / local CPU fallback\n"," MAX_STEPS = 4_000\n"," BATCH_SIZE = 16\n"," GRAD_ACCUM = 2\n"," MAX_WAXAL_TRAIN = 5_000\n","\n","LEARNING_RATE = 1e-3\n","WARMUP_STEPS = max(100, MAX_STEPS // 20)\n","SAVE_STEPS = 500\n","EVAL_STEPS = 500\n","LOGGING_STEPS = 50\n","CORRECTION_REPEAT= 3 # upsample user corrections Nx for emphasis\n","\n","# ─── Paths ────────────────────────────────────────────────────────────────────\n","OUTPUT_DIR = f'{WORKING_DIR}/adapter_{TRAIN_LANG}'\n","DATA_DIR = f'{WORKING_DIR}/data'\n","AUDIO_DIR = f'{WORKING_DIR}/audio_feedback'\n",5 unmodified lines" 'ful': 'Pular (Labé/Mamou dialects) — Guinean orthography',\n","}.get(TRAIN_LANG, '')\n","\n","print(f'Environment : {_ENV}')\n","print(f'Language : {TRAIN_LANG} ({LANG_NAME}) — {LANG_COUNTRY}')\n","print(f'Dialect : {LANG_DIALECT}')\n","print(f'Model : {WHISPER_MODEL_ID}')\n","print(f'Working dir : {WORKING_DIR}')\n","print(f'Output : {OUTPUT_DIR}')\n","print(f'Max steps : {MAX_STEPS} (batch={BATCH_SIZE}, grad_accum={GRAD_ACCUM}, eff={BATCH_SIZE*GRAD_ACCUM})')\n"]},{"cell_type": "code","execution_count": null,"id": "4","metadata": {},"outputs": [],"source": [51 unmodified lines{"cell_type": "code","execution_count": null,"id": "5","metadata": {},"outputs": [],"source": [20 unmodified lines" except Exception:\n"," pass\n","\n","# .env file (RunPod / local) - look in common locations\n","if not HF_TOKEN:\n"," for _env_path in ['/workspace/sahel-voice/.env', './.env', '../.env', os.path.expanduser('~/.env')]:\n"," if os.path.isfile(_env_path):\n"," with open(_env_path, encoding='utf-8') as _f:\n"," for _line in _f:\n"," _line = _line.strip()\n"," if _line.startswith('HF_TOKEN='):\n"," _val = _line.split('=', 1)[1].strip()\n"," if _val and len(_val) >= 2 and _val[0] in ('\"', \"'\") and _val[-1] == _val[0]:\n"," _val = _val[1:-1]\n"," HF_TOKEN = _val\n"," print(f'HF_TOKEN loaded from {_env_path}')\n"," break\n"," if HF_TOKEN:\n"," break\n","\n","if not HF_TOKEN:\n"," HF_TOKEN = os.environ.get('HF_TOKEN', '')\n"," if HF_TOKEN:\n"," print('HF_TOKEN loaded from environment variable.')\n","\n","if not HF_TOKEN:\n"," raise ValueError(\n",16 unmodified lines{"cell_type": "code","execution_count": null,"id": "6","metadata": {},"outputs": [],"source": [35 unmodified lines{"cell_type": "code","execution_count": null,"id": "7","metadata": {},"outputs": [],"source": [64 unmodified lines{"cell_type": "code","execution_count": null,"id": "8","metadata": {},"outputs": [],"source": [60 unmodified lines{"cell_type": "code","execution_count": null,"id": "9","metadata": {},"outputs": [],"source": [35 unmodified lines},{"cell_type": "markdown","id": "10","metadata": {},"source": ["---\n",5 unmodified lines{"cell_type": "code","execution_count": null,"id": "11","metadata": {},"outputs": [],"source": [88 unmodified lines{"cell_type": "code","execution_count": null,"id": "12","metadata": {},"outputs": [],"source": [67 unmodified lines{"cell_type": "code","execution_count": null,"id": "13","metadata": {},"outputs": [],"source": [88 unmodified lines{"cell_type": "code","execution_count": null,"id": "14","metadata": {},"outputs": [],"source": [56 unmodified lines},{"cell_type": "markdown","id": "15","metadata": {},"source": ["---\n",8 unmodified lines{"cell_type": "code","execution_count": null,"id": "16","metadata": {},"outputs": [],"source": [54 unmodified lines{"cell_type": "code","execution_count": null,"id": "17","metadata": {},"outputs": [],"source": [82 unmodified lines},{"cell_type": "markdown","id": "18","metadata": {},"source": ["---\n",7 unmodified lines{"cell_type": "code","execution_count": null,"id": "19","metadata": {},"outputs": [],"source": [51 unmodified lines{"cell_type": "code","execution_count": null,"id": "20","metadata": {},"outputs": [],"source": [30 unmodified lines},{"cell_type": "markdown","id": "21","metadata": {},"source": ["---\n",7 unmodified lines{"cell_type": "code","execution_count": null,"id": "22","metadata": {},"outputs": [],"source": [29 unmodified lines},{"cell_type": "markdown","id": "23","metadata": {},"source": ["---\n",9 unmodified lines{"cell_type": "code","execution_count": null,"id": "24","metadata": {},"outputs": [],"source": [30 unmodified lines{"cell_type": "code","execution_count": null,"id": "25","metadata": {},"outputs": [],"source": [37 unmodified lines{"cell_type": "code","execution_count": null,"id": "26","metadata": {},"outputs": [],"source": [38 unmodified lines}],"metadata": {"kernelspec": {"display_name": "Python 3","language": "python",5 unmodified lines}},"nbformat": 4,"nbformat_minor": 5}26 unmodified lines2728293031323334353637383940414220 unmodified lines636465666768696 unmodified lines7677787980819 unmodified lines9192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291305 unmodified lines13613713813914014114214314414514614714814915015115251 unmodified lines20420520620720820921020 unmodified lines23123223323423523623723816 unmodified lines25525625725825926026135 unmodified lines29729829930030130230364 unmodified lines36836937037137237337460 unmodified lines43543643743843944044135 unmodified lines4774784794804814824835 unmodified lines48949049149249349449588 unmodified lines58458558658758858959067 unmodified lines65865966066166266366488 unmodified lines75375475575675775875956 unmodified lines8168178188198208218228 unmodified lines83183283383483583683754 unmodified lines89289389489589689789882 unmodified lines9819829839849859869877 unmodified lines9959969979989991000100151 unmodified lines105310541055105610571058105930 unmodified lines10901091109210931094109510967 unmodified lines110411051106110711081109111029 unmodified lines11401141114211431144114511469 unmodified lines115611571158115911601161116230 unmodified lines119311941195119611971198119937 unmodified lines123712381239124012411242124338 unmodified lines1282128312841285128612871288128912901291129212931294129512965 unmodified lines1302130313041305130626 unmodified lines{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["print(\"test\")"]},{"cell_type": "code","execution_count": null,"id": "2","metadata": {},"outputs": [],"source": [20 unmodified lines{"cell_type": "code","execution_count": null,"id": "3","metadata": {},"outputs": [],"source": [6 unmodified lines" sys.executable, '-m', 'pip', 'install', '-q', 'jiwer==3.0.4',\n","])\n","\n","import torch\n","print(f\"torch : {torch.__version__}\")\n","print(f\"CUDA avail : {torch.cuda.is_available()}\")\n",9 unmodified lines{"cell_type": "code","execution_count": null,"id": "4","metadata": {},"outputs": [],"source": ["# ── Cell 3: CONFIGURATION — edit these before each run ───────────────────────\n","import os\n","\n","# ─── Language to train ───────────────────────────────────────────────────────\n","# 'bam' = Bambara 'ful' = Fula\n","TRAIN_LANG = 'ful'\n","\n","# ─── Model ───────────────────────────────────────────────────────────────────\n","WHISPER_MODEL_ID = 'openai/whisper-large-v3-turbo'\n","TARGET_SR = 16_000\n","\n","# ─── HuggingFace repos ───────────────────────────────────────────────────────\n","HF_USERNAME = 'ous-sow'\n","FEEDBACK_REPO_ID = f'{HF_USERNAME}/sahel-agri-feedback'\n","ADAPTER_REPO_ID = f'{HF_USERNAME}/sahel-agri-adapters'\n","\n","# ─── Training hyper-parameters ───────────────────────────────────────────────\n","MAX_STEPS = 100 # T4 ~45 min; set 8000 for a deeper run\n","BATCH_SIZE = 16\n","GRAD_ACCUM = 2 # effective batch = 32\n","LEARNING_RATE = 1e-3\n","WARMUP_STEPS = 10\n","SAVE_STEPS = 500\n","EVAL_STEPS = 100\n","LOGGING_STEPS = 50\n","MAX_WAXAL_TRAIN = 500 # cap WaxalNLP samples (streaming budget)\n","CORRECTION_REPEAT= 3 # upsample user corrections Nx for emphasis\n","\n","# ─── Paths (Kaggle working dir) ───────────────────────────────────────────────\n","WORKING_DIR = '/kaggle/working'\n","OUTPUT_DIR = f'{WORKING_DIR}/adapter_{TRAIN_LANG}'\n","DATA_DIR = f'{WORKING_DIR}/data'\n","AUDIO_DIR = f'{WORKING_DIR}/audio_feedback'\n",5 unmodified lines" 'ful': 'Pular (Labé/Mamou dialects) — Guinean orthography',\n","}.get(TRAIN_LANG, '')\n","\n","print(f'Language : {TRAIN_LANG} ({LANG_NAME}) — {LANG_COUNTRY}')\n","print(f'Dialect : {LANG_DIALECT}')\n","print(f'Model : {WHISPER_MODEL_ID}')\n","print(f'Output : {OUTPUT_DIR}')\n","print(f'Max steps : {MAX_STEPS}')"]},{"cell_type": "code","execution_count": null,"id": "5","metadata": {},"outputs": [],"source": [51 unmodified lines{"cell_type": "code","execution_count": null,"id": "6","metadata": {},"outputs": [],"source": [20 unmodified lines" except Exception:\n"," pass\n","\n","if not HF_TOKEN:\n"," HF_TOKEN = os.environ.get('HF_TOKEN', '')\n","\n","if not HF_TOKEN:\n"," raise ValueError(\n",16 unmodified lines{"cell_type": "code","execution_count": null,"id": "7","metadata": {},"outputs": [],"source": [35 unmodified lines{"cell_type": "code","execution_count": null,"id": "8","metadata": {},"outputs": [],"source": [64 unmodified lines{"cell_type": "code","execution_count": null,"id": "9","metadata": {},"outputs": [],"source": [60 unmodified lines{"cell_type": "code","execution_count": null,"id": "10","metadata": {},"outputs": [],"source": [35 unmodified lines},{"cell_type": "markdown","id": "11","metadata": {},"source": ["---\n",5 unmodified lines{"cell_type": "code","execution_count": null,"id": "12","metadata": {},"outputs": [],"source": [88 unmodified lines{"cell_type": "code","execution_count": null,"id": "13","metadata": {},"outputs": [],"source": [67 unmodified lines{"cell_type": "code","execution_count": null,"id": "14","metadata": {},"outputs": [],"source": [88 unmodified lines{"cell_type": "code","execution_count": null,"id": "15","metadata": {},"outputs": [],"source": [56 unmodified lines},{"cell_type": "markdown","id": "16","metadata": {},"source": ["---\n",8 unmodified lines{"cell_type": "code","execution_count": null,"id": "17","metadata": {},"outputs": [],"source": [54 unmodified lines{"cell_type": "code","execution_count": null,"id": "18","metadata": {},"outputs": [],"source": [82 unmodified lines},{"cell_type": "markdown","id": "19","metadata": {},"source": ["---\n",7 unmodified lines{"cell_type": "code","execution_count": null,"id": "20","metadata": {},"outputs": [],"source": [51 unmodified lines{"cell_type": "code","execution_count": null,"id": "21","metadata": {},"outputs": [],"source": [30 unmodified lines},{"cell_type": "markdown","id": "22","metadata": {},"source": ["---\n",7 unmodified lines{"cell_type": "code","execution_count": null,"id": "23","metadata": {},"outputs": [],"source": [29 unmodified lines},{"cell_type": "markdown","id": "24","metadata": {},"source": ["---\n",9 unmodified lines{"cell_type": "code","execution_count": null,"id": "25","metadata": {},"outputs": [],"source": [30 unmodified lines{"cell_type": "code","execution_count": null,"id": "26","metadata": {},"outputs": [],"source": [37 unmodified lines{"cell_type": "code","execution_count": null,"id": "27","metadata": {},"outputs": [],"source": [38 unmodified lines}],"metadata": {"kaggle": {"accelerator": "nvidiaTeslaT4","dataSources": [],"dockerImageVersionId": 31329,"isGpuEnabled": true,"isInternetEnabled": true,"language": "python","sourceType": "notebook"},"kernelspec": {"display_name": "Python 3","language": "python",5 unmodified lines}},"nbformat": 4,"nbformat_minor": 4}
123456{"id": "ous-sow/sahel-voice-master-trainer","title": "Sahel Voice Master Trainer","code_file": "kaggle_master_trainer.ipynb","language": "python","kernel_type": "notebook",123456{"id": "oussow/kaggle-master-trainer","title": "Kaggle Master Trainer","code_file": "kaggle_master_trainer.ipynb","language": "python","kernel_type": "notebook",
12345{"id": "ous-sow/sahel-voice-fula-tts-trainer","title": "Sahel Voice Fula TTS Trainer","code_file": "train_fula_tts.ipynb","language": "python",12345{"id": "oussow/sahel-voice-fula-tts-trainer","title": "Sahel Voice Fula TTS Trainer","code_file": "train_fula_tts.ipynb","language": "python",
README.md+244-21
notebooks/kaggle_master_trainer/kaggle_master_trainer.ipynb+62-108
notebooks/kaggle_master_trainer/kernel-metadata.json+2-2
notebooks/train_fula_tts/kernel-metadata.json+1-1