Fix pruning with non tensor params
What does this PR do?
This pull request fixes the pruning problem made when a model includes non-tensor parameters.
The previous code added all parameters when parameters_to_prune was not provided. However, this causes problems when parameters are not Tensors. I added a line so just Tensor parameters will be included.
Fixes #10835
Does your PR introduce any breaking changes? If yes, please list them.
Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
- [x] Did you read the contributor guideline, Pull Request section?
- [x] Did you make sure your PR does only one thing, instead of bundling different changes together?
- [ ] Did you make sure to update the documentation with your changes? (if necessary)
- [ ] Did you write any new necessary tests? (not for typos and docs)
- [x] Did you verify new and existing tests pass locally with your changes?
- [ ] Did you list all the breaking changes introduced by this pull request?
- [ ] Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)
PR review
Anyone in the community is welcome to review the PR. Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
- [ ] Is this pull request ready for review? (if not, please submit in draft mode)
- [ ] Check that all items from Before submitting are resolved
- [ ] Make sure the title is self-explanatory and the description concisely explains the PR
- [ ] Add labels and milestones (and optionally projects) to the PR so it can be classified
Did you have fun?
Make sure you had fun coding 🙃
Hi everyone,
I think the added check will fix the problem (I checked this using a model from one of my projects). However, I have not yet been able to write a test addressing the change.
I need to instantiate a module with non Tensor params to test the change, which I couldn't do. Can anyone help?
Thanks a lot.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.
This pull request is going to be closed. Please feel free to reopen it create a new from the actual master.