zhijian-liu / torchprofile

A general and accurate MACs / FLOPs profiler for PyTorch models
https://pypi.org/project/torchprofile/
MIT License
571 stars 39 forks source link

Negative MACs #7

Closed thesiti92 closed 4 years ago

thesiti92 commented 4 years ago

I'm getting an overflow encountered error and profile gives me a negative number of MACS. is this a torchprofile issue or an issue with my model?

zhijian-liu commented 4 years ago

Could you please provide me with a sample code that can reproduce this error? Thanks!

thesiti92 commented 4 years ago

RuntimeWarning: overflow encountered in long_scalars I get this warning when running

python search.py --dataroot database/night2day 
--restore_G_path logs/pix2pix/night2day/supernet/checkpoints/latest_net_G.pth 
--output_path logs/pix2pix/night2day/supernet/result.pkl 
--ngf 48 --batch_size 32 
--config_set channels-48 
--real_stat_path real_stat/night2day_B.npz

from the gan-compression repo. I can send you the model if you would like. Seems like to get results I should convert the numbers to something with arbitrary precision.

thesiti92 commented 4 years ago

Example terminal output: image

zhijian-liu commented 4 years ago

Hi, I've tried to convert it to float. Could you please try the latest version and see whether this issue has been resolved?

thesiti92 commented 4 years ago

seems to be ok now. i still get the overflow warning but no longer get negative values. Thanks!

zhijian-liu commented 4 years ago

@thesiti92, could you please check the latest version again and see whether the overflow warning has been resolved? Thanks

thesiti92 commented 4 years ago

yeah sorry my project was on hold for a bit. just tested it and it worked fine for the GAN models i have trained. Thanks again, this is a pretty awesome tool!