Skip to content

new from_single_file implementation is always internet-first and using local files only on timeout #7902

@vladmandic

Description

@vladmandic

Describe the bug

new from_single_file implementation is always internet-first and using local config files only after timeout even if they are already present locally as they were previously downloaded.

code flow is from_single_file -> _download_diffusers_model_config_from_hub -> snapshot_download

and snapshot_download function in huggingface_hub is always checking online first and only on timeout fetching already existing local files first

so to avoid triggering snapshot_download, existing check
if not os.path.isdir(default_pretrained_model_config_name) inside from_single_file
needs to be expanded to cover already downloaded files first

you can verify by looking at simple message in console such as:

Fetching 11 files

that message is valid on first use/download, but should not be triggered every single time model load is triggered.

and message only comes from hf_hub online downloader.
and if you disconnect from network and try again, everything works just fine and model is loaded without that log message but only after connection timeout.

Reproduction

see above

Logs

No response

System Info

diffusers==0.28.0.dev

Who can help?

@yiyixuxu @DN6 @sayakpaul

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions