|
Download code/GUIDE.md from Lucasgitguy-co/Turbo-Kev-Dictate-1.4B: direct link, hf CLI and curl.
- Browser
- Download file 6.69 kB
-
https://huggingface.co/Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/resolve/main/code/GUIDE.md
- Command line
-
hf download hf://Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/code/GUIDE.md
-
curl -L -o GUIDE.md https://huggingface.co/Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/resolve/main/code/GUIDE.md
6.69 kB
| # Turbo-Kev Dictate: how to rebuild it yourself | |
| One fused network that turns English speech into clean text, and also cleans a pasted transcript: | |
| ``` | |
| audio (16 kHz) ─► Whisper-large-v3-turbo encoder (frozen, 0.64B) ─► stack 8 frames ─► projector (trained, 44M) | |
| │ | |
| "<system> <user> [187 audio tokens per 30 s] Transcribe." ────┴─► Kev-0.8B text model ─► clean text | |
| ``` | |
| It is the Ultravox recipe (Fixie's ultravox-v0_5 uses the same Whisper-turbo encoder). The text model is | |
| Qwen3.5-0.8B-Base with Jared Palmer's Kev-0.8B LoRA merged in, plus our own text-cleanup LoRA (stage 1). Kev's | |
| pointer head is a classifier and is not part of a text model, so it is not used. | |
| Everything runs on a MacBook Air M4 with 16 GB. It takes about a day of compute, mostly unattended. | |
| ## Why it is two GGUF files (plus a one-file bundle) | |
| llama.cpp loads a model and its audio projector from two files (`-m` and `--mmproj`). A single merged GGUF does | |
| not load: llama.cpp 1.0.0 fails with "wrong number of tensors; expected 638, got 147" (results/gate0.json). The one-file | |
| download is therefore a bundle (`Turbo-Kev-Dictate-bundle.gguf`): `python3 gguf_bundle.py unpack` turns it back into | |
| the exact two files (sha256 checked). | |
| ## Why training does not start from the GGUFs you named | |
| GGUF files are compressed copies made for running a model, not for training it. Training uses the original | |
| weights: `openai/whisper-large-v3-turbo` (the same weights the oxide-lab GGUFs were made from), | |
| `Qwen/Qwen3.5-0.8B-Base` and `jaredpalmer/kev-0.8b`. The oxide-lab Whisper GGUF is used as the **teacher** that writes | |
| the training transcripts. Its q8_0 file was picked because the smaller ones lose accuracy (results/teacher-quant.json: | |
| q8_0 5.21% WER, q4_k 5.54%, q3_k 5.90%, q2_k broken at 99.9%). "Smallest quant" applies to the result: every quant is | |
| scored and the smallest one that passes is recommended (results/quants.json). | |
| ## 0. What you need | |
| ```bash | |
| brew install uv ffmpeg llama.cpp whisper.cpp | |
| hf auth login # a write token for Lucasgitguy-co, only for publishing | |
| ``` | |
| About 30 GB of free disk. The GGUF converter is the llama.cpp checkout `~/.cache/spot-snake/llama.cpp` (1b6935b) with | |
| its venv `~/.venvs/spot-snake-gguf`. If they are missing: | |
| ```bash | |
| git clone https://github.com/ggml-org/llama.cpp ~/.cache/spot-snake/llama.cpp | |
| git -C ~/.cache/spot-snake/llama.cpp checkout 1b6935b | |
| uv venv --python 3.12 ~/.venvs/spot-snake-gguf | |
| uv pip install --python ~/.venvs/spot-snake-gguf/bin/python -e ~/.cache/spot-snake/llama.cpp/gguf-py \ | |
| "transformers==4.57.6" torch sentencepiece safetensors numpy | |
| ``` | |
| ## 1. The commands | |
| ```bash | |
| cd /Volumes/Untitled/turbo-kev # exFAT drive; the venv is ~/.venvs/turbo-kev-train (exFAT has no symlinks) | |
| bash run.sh setup # venv, models, Kev LoRA merge, tools/tk_embd build (~15 min) | |
| bash run.sh audio # 16 kHz FLAC of every set + spoken prompts (macOS say) + long recordings (~15 min) | |
| bash run.sh teacher # Whisper-turbo q8_0 transcribes ~25,000 clips (~9 h) | |
| bash run.sh data # stage-1 text pairs + stage-2 audio rows + leak check (1 min) | |
| bash run.sh text # stage 1: text-cleanup LoRA on Kev, merged into models/kev-text (~2 h) | |
| bash run.sh proj # stage 2: the projector, one pass over ~22,000 clips (~12 h) | |
| bash run.sh export # release layout + BF16 text GGUF + mmproj (f16, f32) (~5 min) | |
| bash run.sh parity # torch == llama.cpp on the trained model (~5 min) | |
| bash run.sh eval # gates G1-G5 through llama-server, raw Whisper and cascade baselines (~1.5 h) | |
| bash run.sh quants # every quant scored; smallest passing pair; q8_0 mmproj check; one-file bundle (~2 h) | |
| bash run.sh release # release folders + cards rendered from results/ + cards check (1 min) | |
| bash run.sh publish --dry-run && bash run.sh publish # public upload, refused unless every gate passed | |
| ``` | |
| `./run_bg.sh chain bash run.sh chain` starts or resumes the chain in the background and prints its log path. | |
| Use `bash run.sh status` to check the run. Use `bash run.sh stop` to save and stop. | |
| Wait for the saved step or stage-boundary confirmation before disconnecting the drive. | |
| Run the same background command to continue. Text and projector training also save recovery checkpoints | |
| on the Mac every 20 optimizer steps. After an unexpected shutdown, resume from the most recent completed save. | |
| Run one GPU job at a time: two at once (for example the teacher and a training run) made training about 7x slower. | |
| ## 2. The checks | |
| | Check | What | Pass | | |
| |---|---|---| | |
| | G0 | one runnable GGUF file | failed: llama.cpp needs model + mmproj (so: bundle) | | |
| | Parity | torch pipeline vs llama.cpp (tools/tk_embd on the GGUF pair) | same prompt tokens, same audio token count, projector output cosine ≥ 0.999 (CPU f32), same greedy tokens wherever llama.cpp is confident | | |
| | G1 helps | DisfluencySpeech test (250): WER vs the clean transcript | ≥ 25% lower than raw Whisper-turbo | | |
| | G2 no big harm | FLEURS en test (350), LibriSpeech test-clean (300) | ≤ raw Whisper-turbo + 2.0 WER points | | |
| | G3 no answering | 194 spoken questions/commands (held-out prompts and voices) | ≥ 98% transcribed (≤ 10% WER), none 1.3x longer | | |
| | G5 long audio | six 75-81 s recordings (3 windows each) | WER ≤ FLEURS WER + 3 | | |
| | Quants | each GGUF quant + mmproj | G1-G3 pass and within 0.5 WER of BF16 | | |
| Nothing is uploaded unless all of them pass (`tk/publish.py` reads the result files). | |
| ## 3. Things that were easy to get wrong (all handled in the code) | |
| - llama.cpp's Whisper log-mel floors power at 2^-24, not Whisper's 1e-10. Using 1e-10 broke quiet recordings | |
| (cosine 0.69 against llama.cpp). | |
| - llama.cpp makes 187 audio tokens per 30 s window (1500 frames // 8), not 188. | |
| - ggml's conv_1d rounds its inputs (the mel and conv1's output) to fp16. The parity reference does the same. | |
| - Metal's encoder output differs from CPU by 1-2% on a few tokens (cosine ≥ 0.98). That is llama.cpp runtime noise; | |
| parity checks the exact numbers on CPU and the decisions on Metal. | |
| - llama.cpp gives Qwen3.5 M-RoPE positions; for audio tokens they match plain sequential positions in transformers | |
| (checked: greedy tokens identical). | |
| - On the M4, the 248k-vocabulary output layer over whole sequences was most of the training time. The trainers | |
| compute logits only where the loss is. | |
| - macOS has no `timeout` command. | |