microsoft / nni

An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
https://nni.readthedocs.io
MIT License
14k stars 1.81k forks source link

Iterative soft pruning #5676

Open gkrisp98 opened 1 year ago

gkrisp98 commented 1 year ago

Hi, I want to apply iterative soft pruning to an object detector using FPGM pruner from NNI. This means that I want to follow this procedure: -prune the net -train it but with allowing the pruned filters to regain some weight -prune -start again

I wanted to ask : Does using the following code mess up with the models gradients? Because I am observing that although I train the model again after I unwrap it, the model's sparsity remains the same.

pruner = FPGM(net, congif_list)
pruner.compress()
pruner._unwrap_model()

And if it does zero out the gradients, is there a way to modify that to allow pruned weights to receive gradient updates?