Skip to content

[Windows] Fix subfolder config.json silently skipped during download#14153

Open
Functionhx wants to merge 1 commit into
huggingface:mainfrom
Functionhx:fix/windows-download-config
Open

[Windows] Fix subfolder config.json silently skipped during download#14153
Functionhx wants to merge 1 commit into
huggingface:mainfrom
Functionhx:fix/windows-download-config

Conversation

@Functionhx

@Functionhx Functionhx commented Jul 9, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #14142.

os.path.join produces backslash paths on Windows, but fnmatch patterns expect forward slashes. This causes subfolder config.json files to be silently excluded from download.

Fixed in both Diffus\ionPipeline.download() and FlaxDiffusionPipeline.download().

Before submitting

  • Read the contributor guideline
  • Discussed via GitHub issue
  • This PR adds a new model/pipeline — No
  • New tests — No, this is a targeted bug fix
  • Documentation — No changes needed

AI agent disclosure

  • Did you use an AI agent? Yes (code review and verification)
  • Did you read the Coding with AI agents guide? Yes
  • Did you self-review against .ai/review-rules.md? Yes

Who can review?

Anyone in the community.

…ckslash paths

On Windows, os.path.join(k, "config.json") produces paths with backslash
separators (e.g. text_encoder\config.json). These patterns are later passed
to fnmatch, which does not normalize path separators, causing the pattern
mismatch on Windows. The result: subfolder config.json files are silently
excluded from allow_patterns and never downloaded by snapshot_download on
Windows, but downloading works fine on Linux/macOS.

Fix: use an f-string (f"{k}/config.json") to always produce forward-slash
paths, consistent with how other patterns are already constructed in the
same function (f"{k}/*", f"{k}/{f}.py", etc.).

Same bug in FlaxDiffusionPipeline.download(): os.path.join(k, "*") on line
339 of pipeline_flax_utils.py. Fixed identically (f"{k}/*").

Test Plan:
No behavioral change on Linux/macOS (forward slash already used).
On Windows, subfolder config.json files and Flax subfolder wildcards will
now be included in allow_patterns and matched correctly.

Fixes huggingface#14142

Signed-off-by: Yuchen Fan <functionhx@gmail.com>
@github-actions github-actions Bot added fixes-issue pipelines size/S PR with diff < 50 LOC labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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