Hello,
When I apply “tfmot.sparsity.keras.strip_pruning” on the pruned_model Why do I get the same weights, the same parameters and the same size of the original_model?
Isn’t this function just supposed to keep the same structure and then strip the pruned_model from the wrappers (prune_low_magnitude_)?
HI
I didn’t quite understand the question, are you saying that you applied pruning but the outcome model is not pruned?
As you mentioned, strip_pruning is just removing the PruningWrapper from the prunable model which is wrapped for pruning.
Hello,
What I mean is: From what I understant, when applying the strip_pruning function, we will ONLY remove the PruningWrapper from the prunable model but we will keep the same weights, the same parameters and the same size of this exacte pruned model.
The thing is, when I print “stripped_model.summary()” I get as an output the the same weights, the same parameters and the same size as the original model and not the pruned model.
Your understanding is correct. The Strip_pruning function only remove PruningWrapper, not touching any weight values.
If you get unpruned weight after strip_pruning, the problem is in your pruning procedure. Just applying pruning wrapper won’t prune your weight, you should run several trainig steps with appropriate call_back function. Please refer Pruning in Keras example | TensorFlow Model Optimization
thank you for the reply, it really helps