Merged
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
pcuenca
reviewed
Sep 15, 2022
patil-suraj
approved these changes
Sep 15, 2022
Comment on lines
+716
to
+734
| model_id = "hf-internal-testing/unet-pipeline-dummy" | ||
| with tempfile.TemporaryDirectory() as tmpdirname: | ||
| _ = DiffusionPipeline.from_pretrained(model_id, cache_dir=tmpdirname, force_download=True) | ||
| local_repo_name = "--".join(["models"] + model_id.split("/")) | ||
| snapshot_dir = os.path.join(tmpdirname, local_repo_name, "snapshots") | ||
| snapshot_dir = os.path.join(snapshot_dir, os.listdir(snapshot_dir)[0]) | ||
|
|
||
| # inspect all downloaded files to make sure that everything is included | ||
| assert os.path.isfile(os.path.join(snapshot_dir, DiffusionPipeline.config_name)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, CONFIG_NAME)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, SCHEDULER_CONFIG_NAME)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, WEIGHTS_NAME)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, "scheduler", SCHEDULER_CONFIG_NAME)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, "unet", WEIGHTS_NAME)) | ||
| assert os.path.isfile(os.path.join(snapshot_dir, "unet", WEIGHTS_NAME)) | ||
| # let's make sure the super large numpy file: | ||
| # https://huggingface.co/hf-internal-testing/unet-pipeline-dummy/blob/main/big_array.npy | ||
| # is not downloaded, but all the expected ones | ||
| assert not os.path.isfile(os.path.join(snapshot_dir, "big_array.npy")) |
This was referenced Sep 16, 2022
2 tasks
PhaneeshB
added a commit
to nod-ai/diffusers
that referenced
this pull request
Mar 1, 2023
yoonseokjin
pushed a commit
to yoonseokjin/diffusers
that referenced
this pull request
Dec 25, 2023
* [Download] Smart downloading * add test * finish test * update * make style
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.
Improved snapshot downloading for
diffusersIt might happen more and more that a repo folder on the Hub contains more that the necessary diffusion model files.
E.g. Our pipelines should not load CompVis weights in a repo that has both CompVis weights and
diffusersweights, but that would currently be the case which means that bandwidth and local storage is wasted.This PR makes sure via an
allow_patternsthat only the relevant files are actually downloaded.🚨🚨🚨 Please make sure to update
huggingface_hubto0.9.1🚨🚨🚨See: #538