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
23.93k stars 4.93k forks source link

from diffusers.loaders.autoencoder import FromOriginalVAEMixin fails with ImportError #8432

Open juancamilog opened 4 weeks ago

juancamilog commented 4 weeks ago

On 0.28.2, this

from diffusers.loaders.autoencoder import FromOriginalVAEMixin

will fail with this error

ImportError: cannot import name 'create_diffusers_vae_model_from_ldm' from 'diffusers.loaders.single_file_utils' (/usr/local/lib/python3.10/dist-packages/diffusers/loaders/single_file_utils.py)

If you look at the source code, create_diffusers_vae_model_from_ldm imported here: https://github.com/huggingface/diffusers/blob/0d68ddf3275b20b0d12cfd3d0a9f002fecfe001c/src/diffusers/loaders/autoencoder.py#L18

does not exist here: https://github.com/huggingface/diffusers/blob/0d68ddf3275b20b0d12cfd3d0a9f002fecfe001c/src/diffusers/loaders/single_file_utils.py

This commit removed it: https://github.com/huggingface/diffusers/commit/cb0f3b49cbd9f67c088a8cd8e96e477a6ae47764#diff-46dbaee212aec178869ccc3db97f026579819d5fbffbd4321e7063cf472139f8

sayakpaul commented 3 weeks ago

Cc: @DN6

NeoGriever commented 2 weeks ago

Possible Fix:

from diffusers.loaders.autoencoder import FromOriginalVAEMixin

to

from diffusers.loaders.single_file_model import FromOriginalModelMixin

because in the commit is it replaced with it at the same way?

sayakpaul commented 2 weeks ago

@DN6 a gentle reminder :)

DN6 commented 2 days ago

Hi sorry this should have been removed in 0.28. This PR: https://github.com/huggingface/diffusers/pull/8754 removes these deprecated classes in favour of FromOrignalModelMixin