Fix HF cache permissions and add startup fallback#677
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 (2)
📝 WalkthroughWalkthroughBackend startup now sets a Hugging Face hub cache fallback directory under the app's configured cache path when ChangesHugging Face Hub Cache Setup
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes 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)
|
I hit the same issue and suggested a fix in PR #584 — The issue with this PR's approach is that moving the cache to Fixing the ownership in the entrypoint before the privilege drop would resolve both the cache permission issue and the SQLite readonly error without needing the application-level fallback or moving the cache location. |
Summary by CodeRabbit