MrYxJ / calculate-flops.pytorch

The calflops is designed to calculate FLOPs、MACs and Parameters in all various neural networks, such as Linear、 CNN、 RNN、 GCN、Transformer(Bert、LlaMA etc Large Language Model)
https://pypi.org/project/calflops/
MIT License
506 stars 16 forks source link

Library `diffusers` is not supported yet #12

Open XianweiC opened 10 months ago

XianweiC commented 10 months ago

I was trying to calculate the flops of InstructPix2Pix from huggingface using the method described in the README, but I got this error:

ValueError: Library `diffusers` is not supported yet, please open an issue on GitHub for us to add support.

The code that I use:

    from calflops import calculate_flops_hf

    H, W = 128, 512
    model_name = "timbrooks/instruct-pix2pix"

   flops, macs, params = calculate_flops_hf(model_name=model_name, input_shape=(batch_size, 3, H, W))
   print("%s FLOPs:%s  MACs:%s  Params:%s \n" %(model_name, flops, macs, params))
Jiawei804 commented 8 months ago

I'm having the same problem and I'd like to know when this function will be available, any help would be greatly appreciated!

MrYxJ commented 3 months ago

Sorry. The calflops don't support diffuse model for the time being. I will consider supporting such diffuse models in the future when I have time. Thank you for your good suggestion.