Skip to content

Add model.py: the whole speech LLM in one readable file - #154

Merged
alexkroman merged 5 commits into
mainfrom
claude/adoring-fermi-mickoe
Oct 17, 2026
Merged

alexkroman merged 5 commits into
mainfrom
claude/adoring-fermi-mickoe

Conversation

@alexkroman

Copy link
Copy Markdown
Owner

A deliberately simple, heavily commented teaching version of the model:
frozen Whisper encoder, trained frame-stacking MLP projector, frozen LLM
decoder, label masking, a greedy transcribe(), and a tiny overfit loop
(python model.py). tests/test_model_py.py runs it end to end on the
offline fixtures so the read-first file cannot silently rot.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx

A deliberately simple, heavily commented teaching version of the model:
frozen Whisper encoder, trained frame-stacking MLP projector, frozen LLM
decoder, label masking, a greedy transcribe(), and a tiny overfit loop
(`python model.py`). tests/test_model_py.py runs it end to end on the
offline fixtures so the read-first file cannot silently rot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx
Following the course-reframe plan, step 1:

- README leads with the build-promise and the nanoGPT positioning, then a
  three-step quickstart (model.py on a laptop, the published model, the
  full recipe), a "Read this first" section pointing at model.py, a
  numbered chapter table linking into the existing course site, and the
  WER table under "Expected results". Only numbers already in the repo are
  used; the per-budget WER table waits on real runs.
- The HTTP serving reference moves verbatim to docs/SERVING.md.
- model.py is now linted and strict-type-checked with the rest of the
  code (CODE_PATHS, pyright include); build_prompt always returns labels.
- pyproject description matches the new one-liner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx
Keep one code path: a standalone teaching model would drift from the
recipe that actually trains the published model. "Read this first" now
sends readers to tiny_audio/projectors.py, then to _encode_audio /
forward / generate in tiny_audio/asr_modeling.py. The quickstart is the
published model plus the default training run; model.py's entries in
CODE_PATHS, the pyright include list and CONTRIBUTING are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx
configs/experiments/tiny.yaml layers the 73-clip LibriSpeech sample and
portable hardware settings (adamw_torch, no bf16 autocast or tf32, no
dataloader workers, no W&B/Hub, unfused CE allowed) onto the default
recipe. The model block is inherited unchanged, so the free run trains
exactly the encoder/projector/LoRA setup the published model uses, on a
laptop or a free Colab GPU, and saves to outputs/tiny for `ta eval
--local-code`.

Smoke-tested on CPU with the offline fixture models standing in for
Granite/Qwen3.5: the loop trains, the loss falls, and the saved
checkpoint loads and transcribes through the working-tree pipeline.

README, QUICKSTART, CONTRIBUTING and the course budget table point at
it; a config test pins that it shares the default model block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KL2vCbyZuBDbEM6iyKcPsx
@alexkroman
alexkroman merged commit 1cb96bd into main Oct 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants