Skip to content

fix: harden whisper demo setup paths#357

Open
grtninja wants to merge 2 commits intoamd:mainfrom
grtninja:codex/fix-whisper-mic-import
Open

fix: harden whisper demo setup paths#357
grtninja wants to merge 2 commits intoamd:mainfrom
grtninja:codex/fix-whisper-mic-import

Conversation

@grtninja
Copy link
Copy Markdown

@grtninja grtninja commented Apr 11, 2026

What

  • localize the sounddevice import to mic_stream()
  • remove the main()-scoped microphone import dependency
  • align the Whisper CLI model contract with the auto-download helper
  • make whisper-base auto-downloadable and stop advertising unsupported whisper-tiny

Why

mic_stream() uses sd.InputStream, sd.sleep, and sd.PortAudioError, but sounddevice as sd was only imported later inside main(). That can break the microphone path before the symbol is in scope.

The same demo also advertised whisper-base as the default and whisper-tiny as a valid choice while the auto-download helper only knew about small, medium, and large-v3-turbo. That made the documented/default setup path inconsistent before inference even started.

Closes #349.

Validation

  • python -m py_compile Demos/ASR/Whisper/run_whisper.py
  • mocked mic_stream() smoke with a fake sounddevice module, no real microphone access, and no NPU/model load
  • AST contract check confirming the supported CLI model list matches the auto-download model map

@grtninja grtninja changed the title fix: localize sounddevice import for mic path fix: harden whisper demo setup paths Apr 11, 2026
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.

Demos/ASR/Whisper/run_whisper.py bug

1 participant