Repository navigation
Load Whisper at startup; lock dependencies with uv - #43
Merged
Merged
Conversation
The bot now loads the Whisper model on a background thread when it starts, so the first voice note after a deploy no longer waits for it. A voice note that arrives during the load waits for that same load rather than starting a second one. Dependencies are now locked in uv.lock (40 packages, including the indirect ones such as numpy, onnxruntime and ctranslate2). The image installs exactly those versions with `uv sync --locked`, which also removes the placeholder package the Dockerfile used to create. CI installs from the same lock, and the dev tools move to a dependency group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The project is no longer built: imports come from src through PYTHONPATH and pytest's pythonpath, so setuptools and --no-install-project go. uv is mounted for the sync instead of copied into the image, and is pinned by digest. CI uses the same uv version as the image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pungoyal
marked this pull request as ready for review
October 29, 2026 11:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whisper loads at startup. It used to load on the first voice note after every deploy. Now
Bot.run()loads it on a background thread and logswhisper loaded seconds=…. A voice note that arrives during the load waits for that same load.The production logs show that loading wasn't the main cost. For the 17.3 s voice note on 28 Oct, the model loaded in about 1.4 s, and transcribing 1.85 s of audio took about 16 s. Whisper always processes a 30 s window, beam 5 on CPU, so the clip's length barely matters.
Dependencies are locked with uv.
uv.lockpins all 40 packages. The image runsuv sync --locked, with uv mounted only for that step and pinned by digest, which replaces the placeholder-package workaround. CI runs the same uv version. The project itself is no longer built: imports come fromsrc.To change a dependency: edit
pyproject.toml, then runuv lock.Verified:
Bot.run()with only Telegram stubbed loaded Whisper, transcribed a real speech clip, replied, and drained.🤖 Generated with Claude Code