horseee / DeepCache

[CVPR 2024] DeepCache: Accelerating Diffusion Models for Free
https://horseee.github.io/Diffusion_DeepCache/
Apache License 2.0
687 stars 32 forks source link

fix: allow more recent `diffusers` versions #6

Closed iamwavecut closed 7 months ago

iamwavecut commented 7 months ago

I dont know why you only want a certain version of diffusers, but this little check lets you use later versions of diffusers.

iamwavecut commented 7 months ago

@horseee plz check

VainF commented 7 months ago

Hi @iamwavecut, Thanks for the PR. Will check this ASAP. Our project started more than 4 months ago. So, we just fixed the version for better reproducibility.

iamwavecut commented 7 months ago

@VainF thanks for quick response. However, it might not work in certain conditions (f.e. model offload), let me draft it for a while and I'll update you later.

VainF commented 7 months ago

Update:

Hi @iamwavecut, thanks again for your code. May I ask where can I find the function pkg_version? The following snippet works well on my side:

import diffusers
if diffusers.__version__ >= '0.22.0':
    from diffusers.models.normalization import AdaGroupNorm
else:
    from diffusers.models.attention import AdaGroupNorm
iamwavecut commented 7 months ago

@VainF i've encountered a couple of obstacles trying to apply it to the most recent version of diffusers, because of massive overlap of code duplication, so, I investigate the opportunity to not overwrite, but to monkey patch actual forward implementation.

It comes with a cost of patch complexity, but, I believe, I would finish it soon, will create new PR then.

Thanks for merging!