DeepCache icon indicating copy to clipboard operation
DeepCache copied to clipboard

Question about Macs of DeepCache

Open haoweiz23 opened this issue 10 months ago • 7 comments

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 avatar Apr 14 '24 06:04 haoweiz23

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.

haoweiz23 avatar Apr 14 '24 08:04 haoweiz23

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?

Kyuseok-nam avatar Apr 18 '24 14:04 Kyuseok-nam

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

haoweiz23 avatar Apr 19 '24 03:04 haoweiz23

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

haoweiz23 avatar Apr 19 '24 08:04 haoweiz23

@haoweiz23 It works Thank you for the response!

Kyuseok-nam avatar Apr 23 '24 08:04 Kyuseok-nam

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 avatar May 15 '24 09:05 ZTzxj

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!

ZTzxj avatar Jun 05 '24 07:06 ZTzxj