-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add ModelPruning(prune_on_train_epoch_end) to choose when to apply pruning
#7704
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
Conversation
| assert hasattr(pl_module.layer.mlp_3, "weight_orig") | ||
| if not on_train_epoch_end: | ||
| # these checks only work if pruning on `validation_epoch_end` | ||
| # because `on_save_checkpoint` is called before `on_train_epoch_end` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true in current master, but will be after #7357
Codecov Report
@@ Coverage Diff @@
## master #7704 +/- ##
=======================================
- Coverage 93% 88% -5%
=======================================
Files 199 199
Lines 12960 12968 +8
=======================================
- Hits 11990 11379 -611
- Misses 970 1589 +619 |
tchaton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
Co-authored-by: Adrian Wälchli <[email protected]>
|
|
||
| def on_train_end(self, trainer: 'pl.Trainer', pl_module: LightningModule) -> None: | ||
| if self._make_pruning_permanent: | ||
| rank_zero_debug("`ModelPruning.on_train_end`. Pruning is made permanent for this checkpoint.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw now you have a string here that has a period where there is no sentence and also a sentence but with a missing period. xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should've used : to separate haha
Not going to change it, not worth re-running CI just for it
What does this PR do?
See title. Same idea as:
https://github.com/PyTorchLightning/pytorch-lightning/blob/3e5d6e906a0165c59fc898e4c3da44a39771dbd0/pytorch_lightning/callbacks/early_stopping.py#L63-L64
Also, use regexes so we are not testing the seeding.
Last piece before #7357
Before submitting
PR review