Skip to content

Commit

Permalink
Don't pass variant if files are unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-katri committed Aug 10, 2024
1 parent d9267d9 commit 2992a76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generator_process/actions/huggingface_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def hf_snapshot_download(
):
from huggingface_hub import snapshot_download, repo_info
from diffusers import StableDiffusionPipeline
from diffusers.pipelines.pipeline_utils import variant_compatible_siblings

future = Future()
yield future
Expand All @@ -172,10 +173,12 @@ def hf_snapshot_download(
files = [file.rfilename for file in info.siblings]

if "model_index.json" in files:
# check if the variant files are available before trying to download them
_, variant_files = {set(files), set()} if variant is None else variant_compatible_siblings(files, variant=variant)
StableDiffusionPipeline.download(
model,
use_auth_token=token,
variant=variant,
variant=variant if len(variant_files) > 0 else None,
resume_download=resume_download,
)
elif "config.json" in files:
Expand Down

0 comments on commit 2992a76

Please sign in to comment.