Download code/run.sh from Lucasgitguy-co/Turbo-Kev-Dictate-1.4B: direct link, hf CLI and curl.
- Browser
- Download file 5.59 kB
-
https://huggingface.co/Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/resolve/main/code/run.sh
- Command line
-
hf download hf://Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/code/run.sh
-
curl -L -o run.sh https://huggingface.co/Lucasgitguy-co/Turbo-Kev-Dictate-1.4B/resolve/main/code/run.sh
5.59 kB
| # Turbo-Kev Dictate: every step, in order. Each step can be re-run; finished work is skipped or resumed. | |
| # bash run.sh <step> steps: setup audio teacher data text proj export parity eval quants release publish | |
| # chain (teacher..eval) wait-ocr status | |
| # ./run_bg.sh <name> bash run.sh <step> the same, detached (survives closing the terminal) | |
| set -euo pipefail | |
| cd "$(dirname "$0")" | |
| # the venv lives on the internal disk: the project folder is on exFAT (/Volumes/Untitled), which has no symlinks | |
| PY=${TK_PY:-$HOME/.venvs/turbo-kev-train/bin/python} | |
| export PYTHONPATH=$PWD | |
| step=${1:-status}; shift || true | |
| if [[ "$step" == stop ]]; then | |
| exec "$PY" -m tk.control stop | |
| fi | |
| if [[ -z ${TK_RUN_SESSION:-} ]]; then | |
| case "$step" in | |
| chain|text|proj) exec "$PY" -m tk.control run bash run.sh "$step" "$@" ;; | |
| esac | |
| else | |
| "$PY" -m tk.control boundary | |
| fi | |
| case $step in | |
| setup) | |
| brew install uv ffmpeg llama.cpp whisper.cpp | |
| [ -x $PY ] || uv venv --python 3.12 "$(dirname "$(dirname "$PY")")" | |
| uv pip install --python $PY torch torchaudio "transformers>=5" peft accelerate safetensors soundfile jiwer \ | |
| huggingface_hub datasets numpy pyarrow whisper_normalizer requests | |
| mkdir -p models | |
| hf download openai/whisper-large-v3-turbo --local-dir models/whisper-large-v3-turbo --exclude "*.bin" "*.msgpack" "*.h5" "flax*" | |
| hf download Qwen/Qwen3.5-0.8B-Base --local-dir models/Qwen3.5-0.8B-Base | |
| hf download jaredpalmer/kev-0.8b --local-dir models/kev-0.8b | |
| hf download oxide-lab/whisper-large-v3-turbo-GGUF whisper.cpp/whisper-large-v3-turbo-q8_0.gguf --local-dir models/oxide | |
| [ -d models/kev-merged ] || $PY -m tk.kev_merge | |
| clang++ -std=c++17 -O2 -I/opt/homebrew/include tools/tk_embd.cpp -L/opt/homebrew/lib -lmtmd -lllama \ | |
| -Wl,-rpath,/opt/homebrew/lib -o tools/tk_embd | |
| ;; | |
| audio) # ~15 min, 4.2 GB of FLAC | |
| $PY -m tk.audio | |
| $PY -m tk.tts | |
| $PY -m tk.evaluate --label x --make-long | |
| ;; | |
| teacher) # ~9 h: Whisper-large-v3-turbo q8_0 (whisper.cpp) transcribes every clip | |
| $PY -m tk.teacher --quant q8_0 --sets dis-train dis-test dis-val fleurs-en-test ls-clean-300 say-test long \ | |
| fleurs-multi fleurs-en-train vox-en-train ls-train | |
| ;; | |
| data) | |
| $PY -m tk.build_data | |
| ;; | |
| text) # stage 1, ~2 h: text cleanup LoRA on Kev, then merged into models/kev-text | |
| $PY -m tk.train_text --train data/text/train.jsonl --valid data/text/valid.jsonl --out runs/text-lora \ | |
| --epochs 1 --eval-every 200 --n-valid 247 --resume "$@" | |
| "$PY" -m tk.control boundary | |
| $PY -m tk.train_text --merge runs/text-lora/best --out-model models/kev-text | |
| ;; | |
| proj) # stage 2, ~12 h: the projector (Whisper encoder and Kev-text frozen) | |
| $PY -m tk.train_audio --llm models/kev-text --out runs/proj --resume "$@" | |
| ;; | |
| export) # release layout (out/turbo-kev) + BF16 text GGUF + f16/f32 mmproj | |
| $PY -m tk.export --projector runs/proj/best/projector.safetensors --text models/kev-text --out out/turbo-kev \ | |
| --quants BF16 --mm f16 f32 | |
| ;; | |
| parity) # torch == llama.cpp on the trained model (short, quiet, disfluent and a 76 s three-window clip) | |
| G=out/turbo-kev-gguf | |
| $PY scripts/parity.py --label trained --out out/turbo-kev --gguf $G/Turbo-Kev-Dictate-BF16.gguf \ | |
| --mmproj $G/mmproj-Turbo-Kev-Dictate-f16.gguf --mmproj-f32 $G/mmproj-Turbo-Kev-Dictate-f32.gguf | |
| ;; | |
| eval) # gates G1-G5 on the full sets through llama-server (BF16), baselines, and a torch cross-check subset | |
| G=out/turbo-kev-gguf | |
| $PY -m tk.evaluate --label whisper | |
| $PY -m tk.evaluate --label cascade --gguf $G/Turbo-Kev-Dictate-BF16.gguf | |
| $PY -m tk.evaluate --label fused --gguf $G/Turbo-Kev-Dictate-BF16.gguf --mmproj $G/mmproj-Turbo-Kev-Dictate-f16.gguf | |
| $PY -m tk.evaluate --label fused-torch-subset --text-model models/kev-text \ | |
| --projector runs/proj/best/projector.safetensors --limit 30 --sets dis-test fleurs-en-test say-test | |
| ;; | |
| chain) # what runs overnight: teacher (finished clips are skipped) -> data -> text -> proj -> export -> parity -> eval | |
| bash run.sh teacher | |
| bash run.sh data | |
| [ -s models/kev-text/model.safetensors-00001-of-00001.safetensors ] || bash run.sh text | |
| bash run.sh proj | |
| bash run.sh export | |
| bash run.sh parity | |
| bash run.sh eval | |
| ;; | |
| quants) # every GGUF quant scored, smallest passing pair, q8_0 mmproj check, one-file bundle (~2 h) | |
| $PY scripts/quants.py | |
| ;; | |
| release) # release/{model,gguf,dataset}: cards rendered from results/, then checked (results/cards-check.json) | |
| $PY -m tk.release | |
| ;; | |
| publish) # public upload to Lucasgitguy-co, only if every gate + the cards check pass; --dry-run lists files | |
| $PY -m tk.publish "$@" | |
| ;; | |
| wait-ocr) # the user's rule (2026-11-18): continue only once the small-ocr-model-distillation session is finished. | |
| # "finished" = for 30 minutes in a row: that Claude session is not busy and no process runs in its project folder | |
| ocr=/Volumes/Untitled/xiaomi-ocr-mirage | |
| quiet=0 | |
| while [ $quiet -lt 30 ]; do | |
| if grep -qs '"name":"small-ocr-model-distillation".*"status":"busy"' ~/.claude/sessions/*.json \ | |
| || lsof -d cwd 2>/dev/null | grep -q "$ocr"; then quiet=0; else quiet=$((quiet + 1)); fi | |
| sleep 60 | |
| done | |
| echo "OCR session quiet for 30 min at $(date); starting the chain" | |
| bash run.sh chain | |
| ;; | |
| status) | |
| "$PY" -m tk.control status | |
| df -h /System/Volumes/Data | tail -1 | |
| for f in data/teacher/[!.]*.jsonl; do echo "$(wc -l < "$f") $(basename "$f")"; done 2>/dev/null | |
| ls results/ | |
| tail -2 runs/text-lora/train_log.json runs/proj/train_log.json 2>/dev/null || true | |
| ;; | |
| *) | |
| echo "unknown step $step"; exit 2;; | |
| esac | |