Prerequisites
Install Method
Manual Python install (pip / venv)
Operating System
Linux
Steps to Reproduce
- Configure a Cookbook custom model directory that contains a HuggingFace hub cache layout, e.g.
<modelDir>/models--Org--Name/... or <modelDir>/hub/models--Org--Name/... (the layout produced when downloads use HF_HOME / HUGGINGFACE_HUB_CACHE against a custom dir).
- Call
GET /api/model/cached?model_dir=<that path> (or refresh Cached Models in the Serve/Launch UI for that server).
- Observe the returned model list.
Deterministic unit-level repro against _cached_model_scan_script:
- Point
model_dir at a folder whose children are models--* → 0 models.
- Point
model_dir at a parent that contains hub/models--* → one entry with repo_id: hub (unusable).
- Pass the same hub path via
add_hf_cache= → correctly lists Org/Name.
- Flat folders (
MyModel/config.json) still work.
Expected Behaviour
HF hub-layout caches under configured modelDirs should be discovered as org/name models, same as ~/.cache/huggingface/hub.
Actual Behaviour
scan_dir in routes/cookbook_helpers.py explicitly skips top-level models--* entries. /api/model/cached only calls _cached_model_scan_script(model_dirs) and never passes add_hf_cache, so custom dirs with standard HF layout are missed or mislabeled.
Logs / Screenshots
Reproduced on dev with a temp hub layout: hub-as-model_dir → count=0; parent-with-hub → repo_id='hub'; add_hf_cache → Qwen/Qwen3-8B.
Model / Backend (if relevant)
Cookbook / HuggingFace hub cache
Are you willing to submit a fix?
Yes
Additional Information
Prerequisites
devbranch (the default branch you get on clone, where fixes land first) and the bug still reproduces there. Pleasegit pullthe latestdevbefore filing.Install Method
Manual Python install (pip / venv)
Operating System
Linux
Steps to Reproduce
<modelDir>/models--Org--Name/...or<modelDir>/hub/models--Org--Name/...(the layout produced when downloads useHF_HOME/HUGGINGFACE_HUB_CACHEagainst a custom dir).GET /api/model/cached?model_dir=<that path>(or refresh Cached Models in the Serve/Launch UI for that server).Deterministic unit-level repro against
_cached_model_scan_script:model_dirat a folder whose children aremodels--*→ 0 models.model_dirat a parent that containshub/models--*→ one entry withrepo_id: hub(unusable).add_hf_cache=→ correctly listsOrg/Name.MyModel/config.json) still work.Expected Behaviour
HF hub-layout caches under configured
modelDirsshould be discovered asorg/namemodels, same as~/.cache/huggingface/hub.Actual Behaviour
scan_dirinroutes/cookbook_helpers.pyexplicitly skips top-levelmodels--*entries./api/model/cachedonly calls_cached_model_scan_script(model_dirs)and never passesadd_hf_cache, so custom dirs with standard HF layout are missed or mislabeled.Logs / Screenshots
Reproduced on
devwith a temp hub layout: hub-as-model_dir → count=0; parent-with-hub →repo_id='hub';add_hf_cache→Qwen/Qwen3-8B.Model / Backend (if relevant)
Cookbook / HuggingFace hub cache
Are you willing to submit a fix?
Yes
Additional Information
scan_hfon custom dirs (or equivalent), not only flatscan_dirdiscovery.model_dir, alsoscan_hfwhen the dir (ordir/hub) containsmodels--*entries.