XNOR-Net-PyTorch icon indicating copy to clipboard operation
XNOR-Net-PyTorch copied to clipboard

No speedup and memory saving on CIFAR10

Open guangzhili opened this issue 7 years ago • 8 comments

I have played around with CIFAR10 and also done a bit benchmark. It seems BinOp does not have noticeable effect on model size and inference speed compared to NIN model without BinOp. I have tested both on CPU and GPU. I thought the saved model nin.pth.tar would shrink, and the inference would speed up significantly. Do I miss something? Does anyone have this issue? Thanks.

guangzhili avatar Jan 31 '18 08:01 guangzhili

It’s because BinOp is still 32 or 16 bits. There is no packing optimization here. Sad.

fenollp avatar Jan 31 '18 10:01 fenollp

@fenollp Thanks for your reply. What would you suggest to do if I would like to achieve the binary optimization? modify PyTorch core?

guangzhili avatar Jan 31 '18 15:01 guangzhili

@guangzhili useful discussion here here And a GPU kernel based on TensorFlow can be found here But unfortunately, the acceleration is NOT significant. As for compression, I think it's easy to implement.

zhuyinheng avatar Feb 02 '18 06:02 zhuyinheng

@guangzhili An XNOR operation kernel is required to get an acceleration.

I am implementing the kernels as part of my research project. I will release the code after I get the paper published somewhere.

jiecaoyu avatar Feb 02 '18 19:02 jiecaoyu

Thank you @cow8 That's very helpful!

guangzhili avatar Feb 05 '18 02:02 guangzhili

@jiecaoyu Sounds great. Good luck with the paper.

guangzhili avatar Feb 05 '18 02:02 guangzhili

@guangzhili look forward to see your paper ,good luck

mjczyt avatar Feb 28 '18 03:02 mjczyt

My NIN model without BinOp is 946.7k while model with BinOp is 3.9M. That's weird.@jiecaoyu

Paul0629 avatar Jun 28 '18 08:06 Paul0629