fix(pipelines): use forward slash in per-component config.json download allow patterns#14233
Open
sergioperezcheco wants to merge 1 commit into
Open
Conversation
…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>
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.
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