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

Question about Macs of DeepCache #37

Open haoweiz23 opened 2 months ago

haoweiz23 commented 2 months ago

Hi, I tested the MACs of DeepCache with an interval of 5 following your guidance and obtained an average of 156.0782 G MACs, which is not consistent with Table 3 in your paper, where it's stated as 130.45 G.

To elaborate further, in each denoising step, if deep cache is not utilized, the parameters and MACs are as follows:

Params: 859.5210 M

MACs: 484.3895 G

if DeepCache is used,

Params: 859.5210 M

MACs: 76.0022 G

Could you please provide more details on how to reproduce the results?

haoweiz23 commented 2 months ago

Another concern has been raised: count_ops_and_params function does not work when deepcache helper is applied to UNet. The counted flops is 0 in this situation.

Kyuseok-nam commented 2 months ago

Hi, I'm currently trying to calculate the MACs, and Params as well using the flops.py in the source code. I keep getting errors, can you please share how you implemented the code to do this?

haoweiz23 commented 2 months ago

I simply follow the provided guidance and do not encounter complex errors. You can share your log here to discuss the problem.

haoweiz23 commented 2 months ago

Update: As reported in the official paper: "In our experiment, we choose the skip branch 3/1/2 for DDPMs, LDM-4-G and Stable Diffusion respectively." "We choose N=5 to achieve a throughput" I set hyperparameters as:

helper.set_params( cache_interval=5, cache_branch_id=2, skip_mode="uniform" )

Then, I got an average DeepCache (SDv1.5) MACs: 151.0G

Kyuseok-nam commented 2 months ago

@haoweiz23 It works Thank you for the response!

ZTzxj commented 1 month ago

Can you please tell me how to use the flops.py file to calculate the MACs value after applying deepache in stable diffusion and why I am reporting this error AttributeError: 'StableDiffusionPipeline' object has no attribute 'apply', thanks!

ZTzxj commented 1 month ago

Update:As reported in the official paper:"In our experiment, we choose the skip branch 3/1/2 for DDPMs, LDM-4-G and Stable Diffusion respectively.""We choose N=5 to achieve a throughput"I set hyperparameters as:

helper.set_params(cache_interval=5,cache_branch_id=2,skip_mode="uniform")

Then, I got an average DeepCache (SDv1.5) MACs: 151.0G Hello, I would like to ask you why running the count_ops_and_params function reports an error after I add the deepcache helper to the unet network, also I would like to trouble you with the fact that when running calculate MACs your count_ops_and_params function calculates that the input network added is pipe. If it is unet then I would like to ask you how do you get the average value of MACs for five consecutive runs of the unet network, thank you for your answer!