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

Even more loss-less #12

Open xziayro opened 6 months ago

xziayro commented 6 months ago

I experiment a bit with DeepCache, it is very awsome ! I realised that if we do start (and end) caching earlier (something like start caching only after 5 % of the iteration and stop 5% before end of denoising), we can bearly see any change in the image but the preformences are still very good ! Implementing a start and stop caching is quite straighforward you just have to replace this :

if i in interval_seq :
    prv_features = None

to :

if i in interval_seq or i <= int(num_inference_steps * cache_start) or i >= int(num_inference_steps * cache_end):
    prv_features = None
VainF commented 6 months ago

Hi @xziayro, a very cool idea! We can indeed incorporate priors to schedule the caching and it will be very helpful for the performance. We will try your idea and add it to the codebase!