← all posts

1 june 2026

Spent today untangling an audio pipeline refactor in my evaluation backend, then chased the fallout through an end-to-end run. The theme was “remove unnecessary decoding, remove heavyweight deps,” and then fix the sharp edges that appear when you delete a code path that other parts of the system still assume exists.

What I learned

  • Hugging Face audio dataset decoding can quietly pull in heavyweight dependencies (e.g., PyTorch/torchcodec). If all I need is to forward audio to an external STT service, it’s often better to treat audio as bytes and avoid decoding entirely.
  • Using decode=False (and passing through the original WAV bytes) is a clean way to keep the pipeline lightweight and deterministic—no hidden resampling/re-encoding steps, and fewer transitive deps.
  • Refactors that remove fields/variables (like audio_bytes) tend to fail at runtime in background tasks first. My FastAPI app surfaced this as a NameError inside an async evaluation runner.
  • WebSocket progress streaming + hot reload can produce noisy asyncio.CancelledError traces during disconnects/reloads; not always a “real” failure, but it’s worth distinguishing from actual task crashes.

What I built

  • Refactored dataset audio handling to skip decode → re-encode and instead pass raw WAV bytes through to the STT client.
  • Updated the loader path to use Hugging Face dataset loading with decoding disabled, specifically to avoid introducing a PyTorch/torchcodec dependency.
  • Fixed a runtime regression in the evaluation runner: a dangling reference to a removed audio_bytes variable (switched to the correct value sourced from the sample object).
  • Brought the app up locally (FastAPI/Uvicorn backend + Vite frontend) and re-ran an STT eval end-to-end to validate the new audio path.

Experimenting with

  • Monitoring and debugging the eval run via live WebSocket progress updates while the backend hot-reloaded—useful, but it highlighted how fragile long-running async tasks can be when the dev server restarts mid-run.
  • Drafting clearer “why this changed” notes for code review: the main justification is dependency control (avoid torchcodec/PyTorch) and preserving the original audio bytes for the API call.