huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
25.67k stars 5.3k forks source link

from_pretrained: filename argument removed? #9661

Open oxysoft opened 1 week ago

oxysoft commented 1 week ago

What API design would you like to have changed or added to the library? Why?

I do believe there was a filename argument in the past to load a specific checkpoint in a huggingface repository. It appears that this has been removed with no replacement.

What use case would this enable or better enable? Can you give us a code example?

It's impossible to use any of the checkpoints here https://huggingface.co/SG161222/Realistic_Vision_V6.0_B1_noVAE/tree/main without manually downloading and using from_single_file. The checkpoint I want to load is called Realistic_Vision_V6.0_NV_B1_fp16.safetensors, but it seems that the procedure in from_pretrained tries to force and impose a specific name on the user. I understand the need for standards, but many have not respected the standards in the past and now these models cannot be used without additional work.

oxysoft commented 1 week ago

After reading the from_single_file documentation, it seems that this may be the new function for this, which I thought was only for local files on disk. I will investigate further.

a-r-r-o-w commented 1 week ago

I do not remember a filename argument ever being there in from_pretrained. You can specify the filename in hf_hub_download though - to download the configs and safetensor files. As far as I can remember, it was always from_single_file for loading from single safetensors/pickle files and from_pretrained for diffusers-style models.

In any case, I looked through the past 3 0.X.0 releases and did not find an indication that such an argument was removed (unless I missed something). Pinging @yiyixuxu for sanity check