-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permanently Removing Pruned Weights #553
Comments
I reply mainly to have the answer to your question too. |
I tried using Here is the recipe:
The docs doesn't mention that leave_enabled cannot be False, but the validate code enforces that. |
It's strange given that the doc mentions "should be set to false if..." |
Hi @vjsrinivas and @clementpoiret, glad you've been able to use it and successfully prune some models! The leave_enabled flag is specifically used to reapply the masks when continuing to train after. Without this, the weights will gradually diverge from their masked 0 values as gradient descent continues to update them. For your question, the weights are removed in an unstructured way so there is no current way to convert that into a structured reduction in the weight matrix dimensions. This means you'll need to use an Engine that supports the unstructured sparsity for performance and/or memory reduction such as DeepSparse. We are actively working on a TensorRT setup as well which has support for sparsity on the newer Ampere GPUs. If you're looking to reduce the file sizes, you can run a compression algorithm over them to realize the compression gains. Finally, we are working on structured pruning support now and expect to land that in the next week if you're interested in going this route. Structured will prune away whole channels or filters at once enabling decreases in model sizes and faster inference on any deployment environment. The downside is that the maximum sparsity you can achieve will be much less. Thanks, |
@markurtz Thank you for the information! I will be eagerly waiting for the structured pruning updates. I'll close this since my main questions have been answered. |
Hi, thanks for the well-organized repository.
I've been following the classification tutorial that prunes and finetunes ResNet50 for Imagenette. The pruning seemed to have worked and both PTH and ONNX files were saved. I noticed that the weight size doesn't actual decrease from the original unpruned model. I'm assuming the pruned weights are zeroed out? Is there a utility to actually remove the neurons with zeroed weights in PyTorch?
The text was updated successfully, but these errors were encountered: