Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting
What does this PR do?
As discussed in #556 I'd like to propose adding model hooks for training start and end. As I noticed a hook already exists for training start (
on_sanity_check_start
), I basically just renamed toon_train_start
it as I find it clearer (they still coexist for now). If that is ok with you I could then add deprecation warnings foron_sanity_check_start
. We could also let it be as it was if it is just me who finds it clearer that way.I also added
on_train_end
that is executed at the end of the training loop just before logger experiment is closed. It would be a time to log weights, maybe reload best model or anything we could be wanting to do when training ends. I know it is a bit confusing withtraining_end
that happens after each batch, but I didn't find a better name yet and I am obviously open to ideas.I changed tests from
on_sanity_check_start
toon_train_start
but didn't add any foron_train_end
as I am not sure what test I could create.As for the docs, it seems to me that model hooks are undocumented. I could try to document them as I find them very useful, but I am not sure how docs are written in this project.
I am obviously open to feedback, as this PR is pretty much a personal quality of life improvement, so I am not sure it has many use cases.
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?
Of course !