Skip to content

Local DE Coach v0.6.0 — PDF spec implemented: dual-model auto-swap

Choose a tag to compare

@bif26 bif26 released this 13 Sep 02:44
· 4 commits to main since this release

📖 Re-read the architecture PDF and implemented it properly

You were right — I created a comprehensive 33-page architecture specification but then deviated from it during all the dependency fixing. This release re-aligns the code with the PDF.

What the PDF specifies (Chapter 7)

The engine uses both ASR models with automatic dynamic swap:

Endpoint Model RAM Why
/api/score Wav2Vec2 ~1.2 GB Character-level phonetic accuracy
/api/live Whisper tiny int8 ~150 MB Streaming, low latency

Single-model-at-a-time rule: the engine never holds both models in RAM simultaneously. When the user switches from scoring to live mode, swap_model() atomically:

  1. Unloads the current model
  2. Runs gc.collect()
  3. Loads the new model

This keeps peak RAM at ~1.2 GB (Wav2Vec2 alone), well under the 2 GB ceiling.

Wav2Vec2 model fix

The PDF specified facebook/wav2vec2-base-german, but Facebook made that private (401 Unauthorized). You found that facebook/wav2vec2-large-xlsr-53-german IS public (HTTP 200). The large model uses ~1.2 GB RAM but that's fine — only one model is loaded at a time.

What changed from v0.5.1

v0.5.1 had a config flag (DE_COACH_ASR_BACKEND) that let the user pick ONE backend. That was wrong — the PDF's design is to use BOTH automatically:

  • /api/score → automatically uses Wav2Vec2 (swaps from Whisper if needed)
  • /api/live → automatically uses Whisper (swaps from Wav2Vec2 if needed)
  • No user configuration needed — the engine picks the right model per endpoint

Full architecture now implemented

All modules from the PDF are in the project:

  • Dual-model engine with auto-swap (Chapter 7)
  • 5-layer adaptive scorer A1–C1 (Chapter 8)
  • SQLite persistence + SM-2 SRS (Chapters 11–12)
  • Controller (port 8766, always on) managing backend lifecycle
  • System monitor with freeze detection + auto-unload (Chapter 14)
  • Idle auto-stop — backend stops after 15 min inactivity
  • Audio preprocessing — 16kHz + VAD + normalize (Chapter 6)
  • API spec — all endpoints from Chapter 13
  • SvelteKit frontend — 9 routes (dashboard, practice, shadowing, live, progress, srs, analytics, settings, system)
  • Architecture docs site at docs/ (GitHub Pages)

How to upgrade

cd /home/bif/Desktop/Lab/Local_DE_Coach
git pull origin main
rm -rf backend/.venv
./setup.sh
./start.sh

Setup installs:

  1. torch CPU wheel (~200 MB)
  2. transformers + faster-whisper (~50 MB)
  3. Whisper tiny model (~75 MB)
  4. Wav2Vec2 large model (~1.2 GB — takes a few minutes)

Then open http://127.0.0.1:8766 → System page → Start backend.


Full changelog: see git log v0.5.1..v0.6.0