Repository navigation
Fix: just setup omits mlx-audio/mlx-lm install on Apple Silicon - #681
august-hill wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesMLX Package Installation for Apple Silicon
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Cherry-picked from upstream PRs: - jamiepine#629: Refinement language preservation (captures.py + refinement.py) Non-English transcripts were being translated to English during refinement. Adds language-lock header + 'Do not translate' instruction + Chinese few-shot example. - jamiepine#681: Apple Silicon MLX setup (justfile) Adds --no-deps install of mlx-lm==0.31.1 mlx-audio==0.4.1 to fix broken fresh installs (transformers version conflict). - jamiepine#788: Kokoro male Mandarin voices (kokoro_backend.py) Adds 4 missing male Mandarin Chinese voices: zm_yunjian, zm_yunxi, zm_yunxia, zm_yunyang. - jamiepine#667: SQLite WAL mode + busy timeout (session.py) Fixes 'database is locked' errors under concurrent load. PRAGMA journal_mode=WAL, busy_timeout=5000. - jamiepine#539: Intel XPU IPEX optional (app.py + base.py + health.py) Makes IPEX import optional (try/except). Fixes Intel Arc/XPU support without requiring IPEX. (Task spec said jamiepine#538, actual PR is jamiepine#539.) - jamiepine#621: Model cache validation (pytorch_backend.py + numpy compat) Checks for config files (not just weight files). Fixes partial cache detection crashes. Refactors pyi_rth_numpy_compat into testable _install_torch_numpy_fallback function with regression tests. - jamiepine#677: HF cache permissions + startup fallback (app.py + docker-compose.yml) Sets HF_HUB_CACHE env var with fallback. Fixes container permission issues.
…ical fixes plus cache-validation test coverage (IPEX optional, MLX setup, SQLite WAL, refinement language preservation, Kokoro male Mandarin, HF cache permissions, model cache validation, pyi_rth refactor) Cherry-picks (with IPEX jamiepine#538/jamiepine#539 ordering verified by content): - PR jamiepine#629 — Refinement language preservation (zh/fr/ja/ru lock + few-shot demo) - PR jamiepine#681 — Apple Silicon MLX setup (justfile --no-deps mlx-lm/mlx-audio pins) - PR jamiepine#788 — Kokoro male Mandarin voices (4 zm_ voices) - PR jamiepine#667 — SQLite WAL journal mode + 5s busy_timeout via SQLAlchemy creator lambda - PR jamiepine#538 — Intel XPU IPEX optional (native torch.xpu first, IPEX optional) - PR jamiepine#621 — Model cache validation (require config/preprocessor/tokenizer files in Whisper snapshots) - PR jamiepine#677 — HF cache permissions (HF_HUB_CACHE under /app/data for non-root containers) - PR (refactor) — pyi_rth_numpy_compat: extract _install_torch_numpy_fallback to a testable module-level function (3 new tests) Zeph added 3 regression tests in test_pytorch_cache_validation.py to cover the partial-cache guard in PyTorchSTTBackend._is_model_cached (no other workers covered the missing-preprocessor_config case). Test results on merged main: 95 passed / 1 pre-existing failure (test_hf_progress_tracker — unrelated, fails on both sides of the merge). Review checklist: [x] IPEX fix verified — try/except inversion matches jamiepine#538 content (try IPEX, fall back to native torch.xpu) [x] Each cherry-pick matches its upstream diff [x] No secrets, no merge markers, no debug leftovers [x] SQLite WAL uses SQLAlchemy creator= lambda (correct pattern) [x] justfile MLX pins mlx-lm==0.31.1 / mlx-audio==0.4.1 (matches release.yml) [x] Tests run from branch and merged tree — no regressions [x] Lint: no new ruff errors introduced vs main baseline (993 vs 1008 — actually 15 fewer)
Cherry-pick PR jamiepine#796 — capture preview placement with 6 options: - Persisted preview_location setting (top/bottom × left/center/right) - Rust window positioning using selected location + monitor containing cursor - DictatePreviewState with mutex-protected location - i18n translations for en/ja/zh-CN/zh-TW - Frontend dropdown in Capture settings Skips justfile MLX audio fix (duplicates jamiepine#681 already merged in T3).
Cherry-pick selected files from PR jamiepine#743 (excludes mlx_backend.py — superseded by jamiepine#789 already merged): 1. app/src/lib/hooks/useGenerationProgress.ts — SSE reconnect with exponential backoff (base 1s, max 30s, cap 8 attempts). Replaces invalidateQueries with refetchQueries. Adds errorCountRef and reconnectTimersRef for reconnect state tracking. 2. backend/services/generation.py — _validate_generated_audio: checks sample_rate > 0, audio not None/empty, finite values (no NaN/Inf). Adds logger.exception for structured error logging on generation failures. 3. backend/services/task_queue.py — traceback.print_exc() replaced with logger.exception() for proper structured logging. 4. app/src/lib/api/types.ts — backend_variant comment updated to include xpu and metal. 5. backend/models.py — backend_variant comment updated to include xpu and metal. 6. backend/routes/health.py — adds metal variant for MLX backend_type. 7. justfile — mlx-lm/mlx-audio --no-deps install already applied in prior merge (T3/jamiepine#681). Also adds 12 tests for _validate_generated_audio covering: valid audio (np array and list), None audio, empty audio (array and list), zero/ negative/None sample_rate, NaN, +Inf, -Inf, and multichannel audio.
Problem
A fresh
just setupon Apple Silicon produces a venv missing themlx_audiomodule. Any MLX model load — e.g. downloading Whisper for dictation — then fails with:In the app this surfaces as a model download that appears to stall on "Connecting to download…": the background download task raises immediately, but the progress UI is never moved off its initial state, so it looks like a hung/slow download rather than an error.
Root cause
backend/requirements-mlx.txtintentionally excludesmlx-audio— from 0.3.1 it declarestransformers>=5.x, which conflicts with thetransformers<=4.57.6cap inrequirements.txt. That file's own comment says to install it separately withpip install --no-deps mlx-audio==0.4.1, pointing to.github/workflows/release.yml.release.ymldoes exactly that. Butsetup-pythonin thejustfile— the path every contributor and local builder uses — installsrequirements-mlx.txtand stops. Release builds getmlx-audio; local dev/build setups silently do not.Fix
Add the two
--no-depsinstalls to the Apple Silicon branch ofsetup-python, mirroringrelease.yml:Windows
setup-pythonis unaffected (no MLX path). One file changed (justfile).Testing
On an M-series Mac, after applying the fix:
python -c "import mlx_audio, mlx_lm"succeeds.whisper-turbomodel (openai/whisper-large-v3-turbo, 1.62 GB) downloads and loads:Note on the PR checklist
CONTRIBUTING.mdasks contributors to updateCHANGELOG.md, butCHANGELOG.md's header states it is compiled automatically and must not be edited manually. I left it untouched accordingly — flagging the doc inconsistency in case the checklist wording should be revisited.Summary by CodeRabbit