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.
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
Keep track of the best model's path saved by ModelCheckpoint #1799
Keep track of the best model's path saved by ModelCheckpoint #1799
Changes from 7 commits
ed3e6f3
33ea275
5fe9a58
7a92c00
1434249
648c152
8c59480
0ee63a9
24c27a0
3f4901d
5a7ea43
f09372f
bc2baad
ac36651
7b8a633
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
here the best means
best_score
? otherwise, it is a bit confusing to havebest
andbest_model
pls add types to the init 🐰
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.
Yes,
self.best
is the best "monitored quantity". But that's existing naming. Changing it will break backwards compatibility. If that's OK, I can surely rename it. Otherwise,best_model
could bebest_model_path
. I usedbest_model
to keep consistency with the existingkth_best_model
attribute.As for type hints, there's no changes to the arguments. Where specifically would I add them?
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.
@PyTorchLightning/core-contributors are we fine to rename
best
>>best_score
?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 would prefer it (
best_score
), but if we do that we need to provide our users with a utility to upgrade their checkpoints (basically switchbest
tobest_score
) and temporarily have a warning which catches old checkpoints at load time and alerts users of the utility to convert. it's a very simple utility but we should provide it for our users if we move forward with this.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.
@jeremyjordan you mean to keep compatible with past saved checkpoint which contains
best
? That shall be simple, in loading, we will mapbest
>>best_score
... and yes we shall wrap the deprecatedbest
with some warning :]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.
OK, I renamed
best
tobest_model_score
andbest_model
tobest_model_path
, since havingbest_score
andbest_model
would still be a bit confusing (IMHO). To keep consistency, I also renamedkth_best_model
tokth_best_model_path
.I added properties for
best
andkth_best_model
that log a deprecation warning and return the correct value.When loading a checkpoint, if it's in an old format, the value for
best
is simply assigned tobest_model_score
. In my opinion, adding a warning in this part will not really help the user, as there's not much they can do.Let me know of any further changes.