fix: bundle mlx-whisper in macOS app so Apple Silicon uses the fast backend#148
Draft
fix: bundle mlx-whisper in macOS app so Apple Silicon uses the fast backend#148
Conversation
0cd3444 to
fcda650
Compare
629c9d3 to
53680a7
Compare
…ing (#169) (#171) The existing `is_rate_limited` check matched "429"/"rate limit" in `str(e)`, which works for the typical `HfHubHTTPError` format but silently misses edge cases where the error message omits the HTTP status code (e.g. quota-exceeded variants with no "429" in the text). Add a secondary check: if the exception carries a `.response` attribute with `status_code == 429`, treat it as rate-limited regardless of the message text. This mirrors how `tts.py` already checks `http_err.response.status_code`. Applies to both the faster-whisper and MLX Whisper backends in listener.py. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…ackend
PyInstaller couldn't detect mlx_whisper and mlx because they're
conditionally imported only on Apple Silicon. This adds the necessary
hidden imports, submodule collection, and data files so the bundled
.app no longer silently falls back to the slower faster-whisper engine.
Key changes to jarvis_desktop.spec:
- collect_submodules for mlx_whisper, tiktoken, and numba (runtime deps)
- List specific mlx submodules (mlx, mlx.core, mlx._reprlib_fix,
mlx.nn, mlx.utils) instead of collect_submodules('mlx') which causes
nanobind to double-register native types and abort
- Filter out mlx_whisper.torch_whisper (needs PyTorch, which is excluded)
- Keep scipy on macOS (remove from excludes) since mlx_whisper needs it
- Bundle mlx.metallib (128 MB Metal shader library) required by mlx.core
- Collect data files for mlx_whisper and tiktoken
Closes #122
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53680a7 to
4543f9d
Compare
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
collect_submodules('mlx')andcollect_submodules('mlx_whisper')to the PyInstaller spec for macOS builds, so all MLX native extensions and submodules are bundledcollect_data_files('mlx_whisper')for any asset files the package ships'mlx_whisper'as a static hidden import entrysys.platform == 'darwin'with a try/except fallback (no-op on non-macOS or when mlx isn't installed)Previously, the bundled macOS .app silently fell back to
faster-whisperbecause PyInstaller couldn't detect the conditionally-importedmlx_whisper/mlxpackages.Closes #122
Test plan
tests/test_pyinstaller_spec.pywith 8 tests verifying MLX bundling configurationimport mlx_whispersucceeds inside the bundlemlxbackend on Apple Silicon instead of falling back tofaster-whisper🤖 Generated with Claude Code