-
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
Default value for ModelCheckpoint filepath #1548
Default value for ModelCheckpoint filepath #1548
Conversation
Just an idea, it would be even better to allow user to specify save path and checkpoint filename template separately. I might want to override the template also to include useful metrics, etc, but I still wouldn't want to mess with default save path. Would be a bit harder to do that while respecting backwards compatibility. |
I agree that it would be nice to split |
We could add |
Nice idea, let me try to implement it. From what future version should |
sounds good to me... |
@@ -90,12 +94,14 @@ def __init__(self, filepath: str, monitor: str = 'val_loss', verbose: bool = Fal | |||
|
|||
self.monitor = monitor | |||
self.verbose = verbose | |||
if os.path.isdir(filepath): | |||
self.dirpath, self.filename = filepath, '{epoch}' | |||
if filepath is None: # will be determined by trainer at runtime |
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.
it is will be deprecated there shall be 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.
@SkafteNicki mind add deprecation warning?
@Borda the changes have already been merged, before I had time to do the change we discussed. Should I go ahead and make a new PR? |
Yes please |
Before submitting
What does this PR do?
Fixes #1535.
As the issue outlines, it is not easy for the user to change some of the argument in
ModelCheckpoint
(likesave_top_k
) and still keep the default filepath because it is determined at runtime. This PR implements the option to pass infilepath=None
which will be detected at runtime, and then filepath will be set to the default location.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 🙃