Local whisper transcription#3723
Open
dilidin2 wants to merge 3 commits into
Open
Conversation
This was referenced May 10, 2026
- Replace deprecated asyncio.get_event_loop() with get_running_loop()
in _schedule_unload() and transcribe()
- Clear _unload_handle in _do_unload() to avoid stale reference
- Remove autouse=True from _reset_faster_whisper_cache fixture
- Rewrite auto_device tests using sys.modules patching instead of
patch('torch.cuda.is_available') — no torch dependency needed
- Add test_faster_whisper_auto_device_torch_not_installed case
998951b to
8c25809
Compare
This was referenced May 11, 2026
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.
Summary
Adds support for local voice transcription via faster-whisper, a fast C++/ONNX reimplementation of Whisper that runs entirely on the host machine — no API key or network access required.
This is useful for users who:
Changes
nanobot/providers/transcription.py— addsFasterWhisperTranscriptionProviderwith:asyncio.Lockto prevent concurrent calls from loading the model twicenanobot/channels/base.py— addstranscription_model_sizeandtranscription_devicefields toBaseChannelnanobot/config/schema.py— adds the same two fields toChannelsConfig;transcription_providernow accepts"local"in addition to"groq"and"openai"pyproject.toml— adds optional dependency grouplocal-transcriptiontests/providers/test_transcription.py— adds tests for missing file, missing package, device auto-detection, model caching, and concurrent call safetyInstallation
faster-whisper is an optional dependency and must be explicitly installed:
uv tool install "nanobot-ai[local-transcription]"The Whisper model weights (~500 MB for
small) are downloaded automatically on first use and cached in~/.cache/huggingface/hub/.Configuration
Add the following to your nanobot config:
{ "transcriptionProvider": "local", "transcriptionModelSize": "small", "transcriptionDevice": "cpu" }Available model sizes (trade-off between quality, speed and RAM):
tinybasesmallmediumlarge-v3Notes
faster-whisperis not installed andprovider: localis configured, the transcription returns an empty string and logs a clear install instructiontorchis not a required dependency — CUDA auto-detection gracefully falls back to CPU if torch is not presentThis implementation was developed with AI assistance.