Skip to content

fix(pipelines): use forward slash in per-component config.json download allow patterns#14233

Open
sergioperezcheco wants to merge 1 commit into
huggingface:mainfrom
sergioperezcheco:fix/download-allow-patterns-forward-slash
Open

fix(pipelines): use forward slash in per-component config.json download allow patterns#14233
sergioperezcheco wants to merge 1 commit into
huggingface:mainfrom
sergioperezcheco:fix/download-allow-patterns-forward-slash

Conversation

@sergioperezcheco

Copy link
Copy Markdown

DiffusionPipeline.download() builds the allow pattern for each model folder's config.json with os.path.join(folder, "config.json"), which produces a backslash on Windows. Hub repo paths always use forward slashes, and since huggingface_hub 1.22.0 patterns are matched case-sensitively with fnmatch.fnmatchcase (no separator normalization), the backslash patterns match nothing on Windows and every per-component config.json (unet/config.json, vae/config.json, text_encoder/config.json) is silently skipped from the download. The pipeline then fails to load and keeps failing because the incomplete snapshot is treated as fully cached.

This changes that single line to build the pattern with a literal forward slash, which is exactly what every other allow_patterns entry in this function already does (e.g. the custom component and non-model-folder patterns above it). I added a regression test in DownloadTests that asserts the component config patterns never contain a backslash, so the invariant holds on every platform.

Fixes #14142

…ad allow patterns

DiffusionPipeline.download() built the allow pattern for each model
folder's config.json with os.path.join(folder, 'config.json'), which
uses a backslash on Windows. Hub repo paths always use forward slashes,
and since huggingface_hub 1.22.0 patterns are matched case-sensitively
with fnmatch.fnmatchcase (no separator normalization), so the backslash
patterns matched nothing on Windows and every component config.json was
silently skipped. Build the pattern with a literal forward slash, which
matches every other allow_patterns entry in this function.

Fixes huggingface#14142

Signed-off-by: Sergio Perez <checo520@outlook.com>
@github-actions github-actions Bot added size/S PR with diff < 50 LOC fixes-issue tests pipelines and removed size/S PR with diff < 50 LOC labels Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DiffusionPipeline.download() on Windows silently skips all subfolder config.json files with huggingface_hub>=1.22.0

1 participant