pytorch-pruning
pytorch-pruning copied to clipboard
Any suggestions on how can I extend this code for MobileNetV2?
The given example of VGG16 works well for me. I want to try out this method on a MobiletNetV2 model. VGG16 has a pretty simple structure: a sequence of convs and other layers. However, MobiletNetV2 has a peculiar structure contains InvertedResidualBlocks, which is making the extension hard for me.
Any suggestions?
Did you find a solution to this?
@aprams Yes I did, had to do multiple changes to make that work. I basically flattened the mobilenetv2 model into a flat model before feeding into this code (dealing with the residual links is the trickiest part in the flattening process). Secondly, I changed prune.py
significantly to address batchnorm layers, and depthwise convs. I hope that helps.
@nekulkarni Can you share me your code,please? I need to prune the mobilenetv2 for the school project but I am the beginner for python.
@aprams Yes I did, had to do multiple changes to make that work. I basically flattened the mobilenetv2 model into a flat model before feeding into this code (dealing with the residual links is the trickiest part in the flattening process). Secondly, I changed
prune.py
significantly to address batchnorm layers, and depthwise convs. I hope that helps.
Thanks for sharing, could you please share more about how to deal with batchnorm layers? Thanks so much.
@nekulkarni , I have pruned mobilenetv2 correctly, but the pruned model is difficult to train on imagenet, the accuracy is very low( I train with a 1080Ti, batchsize=96, lr=0.045, weight decay=0.00004, and decrease the lr 0.98 for each epoch, and i also try lr =0.1, lr = lr * (0.1 ** (epoch // 30)) ). can you tell me your data set and accuracy. thank you very much!
It seems that mobilenetv2 convergence slowly !
@nekulkarni Can you share me your code about mobilenetv2 pruned ,please? I am a beginner. Thank you very much!
@viviov Can you share me your code about mobilenetv2 pruned ,please? I am a beginner. Thank you very much!
@nekulkarni Can you share the code with me also? I want to know how to deal with batch norm layers. Thank you very much.!!