fix(cookbook): scan macOS HF Library/Caches so Serve lists downloads - #5980
Draft
michaelxer wants to merge 1 commit into
Draft
fix(cookbook): scan macOS HF Library/Caches so Serve lists downloads#5980michaelxer wants to merge 1 commit into
michaelxer wants to merge 1 commit into
Conversation
michaelxer
force-pushed
the
michaelxer/fix-macos-hf-cache-scan-5978-20260810
branch
2 times, most recently
from
August 11, 2026 01:11
f7e5087 to
c34c0e2
Compare
Serve's /api/model/cached only looked under ~/.cache/huggingface/hub (plus env overrides). On macOS, huggingface_hub/Xet often writes under ~/Library/Caches/huggingface/hub, so freshly downloaded models never appeared in the Launch list (odysseus-dev#5978). Also: - honor HF_HUB_CACHE - if HF_HOME already points at a hub directory, scan it directly - when a custom modelDir is itself an HF hub cache (models--*), run scan_hf in addition to scan_dir so those entries are listed (odysseus-dev#5507) Regression tests cover the macOS path, HF_HOME=hub, and hub-layout modelDirs.
michaelxer
force-pushed
the
michaelxer/fix-macos-hf-cache-scan-5978-20260810
branch
from
August 12, 2026 17:48
c34c0e2 to
8856d5c
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
On macOS, Hugging Face downloads often land under
~/Library/Caches/huggingface/hub(and users may setHF_HOMEto the hub directory itself). Serve's/api/model/cachedscanner only looked under~/.cache/huggingface/hub(plus a few env overrides), so freshly downloaded models never appeared in the Launch list even though the files were on disk.This PR adds the macOS Library/Caches hub path, honors
HF_HUB_CACHE, treatsHF_HOMEpointing at a hub directory as scannable, and also runsscan_hffor custommodelDirsthat are themselves HF hub caches (models--*).Target branch
dev, notmain.Linked Issue
Fixes #5978
Related: #5507 (custom modelDirs with HF hub layout)
Type of Change
What changed
In
routes/cookbook_helpers.py_cached_model_scan_script:~/Library/Caches/huggingface/hubto default HF cache candidates.HF_HUB_CACHE.HF_HOMEis set, scan both$HF_HOME/hubandHF_HOMEitself (when the env already points at a hub tree).model_dir, callscan_hf(normalize_model_dir(...))beforescan_dir(...)so hub-layout directories are listed.How to Test
python -m pytest \ tests/test_cookbook_helpers.py::test_cached_model_scan_includes_macos_library_caches \ tests/test_cookbook_helpers.py::test_cached_model_scan_hf_home_pointing_at_hub_dir \ tests/test_cookbook_helpers.py::test_cached_model_scan_model_dir_with_hf_hub_layout \ tests/test_cookbook_helpers.py::test_cached_model_scan_uses_huggingface_cache_env \ tests/test_cookbook_helpers.py::test_cached_model_scan_runs_additional_hf_cache \ tests/test_cookbook_helpers.py::test_cached_model_scan_reports_plain_dir_gguf \ -q # 6 passedManual (macOS):
~/Library/Caches/huggingface/hub/models--….ln -sinto~/.cache.Checklist
dev.HOME/Library/Caches/…path.Visual / UI changes
None — backend scanner only.