Improve downloads of sharded variants by DN6 · Pull Request #9869 · huggingface/diffusers (original) (raw)
What does this PR do?
Our current check for variants in variant_compatible_sibling
downloads extra non variant files. See: #9253 (comment)
This is because we check if a non-variant filename has an equivalent variant filename. e.g. transformers/model-0003-0005.safetensors
has transformers/model-fp16-0003-0005.safetensors
in its variants. If it doesn't, we add the file to the list of allowed patterns to download.
This type of check doesn't work for sharded checkpoints since variants of smaller dtypes such as fp16
will always have a fewer number of shards. Therefore the non-variant shard file have no equivalent variant shard file.
This PR:
Changes the check to see if a variant exists for a pipeline component (regardless of whether it's sharded or not). If a variant exists for the component, we don't attempt to add any more files related to that component.
Fixes # (issue)
Before submitting
- This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- Did you read the contributor guideline?
- Did you read our philosophy doc (important for complex PRs)?
- Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
- Did you make sure to update the documentation with your changes? Here are the
documentation guidelines, and
here are tips on formatting docstrings. - Did you write any new necessary tests?
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.