-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
passing batch outputs to on_train_batch_end #4369
Conversation
Hello @swethmandava! Thanks for updating this PR.
Comment last updated at 2021-01-26 12:16:43 UTC |
Thanks for the PR! Please take a second look as it seems test are failing... |
@swethmandava could you please check failing tests and also add a test for this change? |
@Borda @edenlightning fixed pytest errors. it now fails with |
Hey all, I'm working on a callback that would generate a plot of model outputs each epoch and encountering an issue that appears to be related to this. I'd expect I should be able to grab the model outputs from the Is this issue still being worked on? If not, is there a suggested workaround? Thanks! |
@SeanNaren @tchaton can this be merged? |
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.
Would it be possible to have a test ?
Apologies for the stale! A simple boring model test that ensures that if the user overrides this hook, they retrieve the appropriate model outputs would be nice :) Similar to this: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/models/test_hooks.py#L52 thanks for working on this! |
batch_output.training_step_output_for_epoch_end, | ||
self.early_stopping_accumulator, | ||
self.checkpoint_accumulator, | ||
) | ||
|
||
# hook | ||
# TODO: add outputs to batches |
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.
anyone knows what this todo means?
Done! |
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 !
Thanks @swethmandava for doing this and apologies on the delay, fell through the cracks a few times... |
|
||
class LoggingCallback(pl.Callback): | ||
|
||
def on_train_epoch_end(self, trainer, pl_module): |
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.
@SeanNaren flake8 found this bug, but it was still merged, could pls fix it in #5666
most likely on_train_epoch_end
>> on_train_epoch_start
as *_end
is here twice
* passing batch outputs to on_train_batch_end * styling * updating epoch end logic * also condition on on_train_epoch_end hooks * more readable * pep8 * pep8 * readability suggestion accepted Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * adding test_training_epoch_end_metrics_collection_on_override test * fix formatting * fix formatting Co-authored-by: Swetha Mandava <smandava@nvidia.com> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> Co-authored-by: Sean Naren <sean.narenthiran@gmail.com> Co-authored-by: Roger Shieh <sh.rog@protonmail.ch> (cherry picked from commit 5fcca4e)
* passing batch outputs to on_train_batch_end * styling * updating epoch end logic * also condition on on_train_epoch_end hooks * more readable * pep8 * pep8 * readability suggestion accepted Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * adding test_training_epoch_end_metrics_collection_on_override test * fix formatting * fix formatting Co-authored-by: Swetha Mandava <smandava@nvidia.com> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> Co-authored-by: Sean Naren <sean.narenthiran@gmail.com> Co-authored-by: Roger Shieh <sh.rog@protonmail.ch> (cherry picked from commit 5fcca4e)
* passing batch outputs to on_train_batch_end * styling * updating epoch end logic * also condition on on_train_epoch_end hooks * more readable * pep8 * pep8 * readability suggestion accepted Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * adding test_training_epoch_end_metrics_collection_on_override test * fix formatting * fix formatting Co-authored-by: Swetha Mandava <smandava@nvidia.com> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> Co-authored-by: Sean Naren <sean.narenthiran@gmail.com> Co-authored-by: Roger Shieh <sh.rog@protonmail.ch> (cherry picked from commit 5fcca4e)
* passing batch outputs to on_train_batch_end * styling * updating epoch end logic * also condition on on_train_epoch_end hooks * more readable * pep8 * pep8 * readability suggestion accepted Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * adding test_training_epoch_end_metrics_collection_on_override test * fix formatting * fix formatting Co-authored-by: Swetha Mandava <smandava@nvidia.com> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> Co-authored-by: Sean Naren <sean.narenthiran@gmail.com> Co-authored-by: Roger Shieh <sh.rog@protonmail.ch> (cherry picked from commit 5fcca4e)
What does this PR do?
Passes batch outputs to on_train_batch_end instead of epoch end outputs
Fixes #4326
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃