Skip to content
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

Versioning of last checkpoints #12902

Merged
merged 5 commits into from
Apr 29, 2022
Merged

Versioning of last checkpoints #12902

merged 5 commits into from
Apr 29, 2022

Conversation

otaj
Copy link
Contributor

@otaj otaj commented Apr 27, 2022

What does this PR do?

Versioning of last checkpoints
Fixes #5030

Does your PR introduce any breaking changes? If yes, please list them.

The change should not be breaking if you do not rely on explicit name of the last checkpoint and use last_model_path instead.
One existing test needed to be adjusted.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

cc @Borda @carmocca @awaelchli @ninginthecloud @jjenniferdai @rohitgr7

@otaj otaj added feature Is an improvement or enhancement callback: model checkpoint labels Apr 27, 2022
@otaj otaj added this to the 1.7 milestone Apr 27, 2022
@otaj otaj self-assigned this Apr 27, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
otaj and others added 2 commits April 28, 2022 08:56
Co-authored-by: Carlos Mocholí <[email protected]>
Co-authored-by: Carlos Mocholí <[email protected]>
@otaj otaj enabled auto-merge (squash) April 28, 2022 07:55
@mergify mergify bot added the ready PRs ready to be merged label Apr 28, 2022
@otaj otaj merged commit c461854 into master Apr 29, 2022
@otaj otaj deleted the feature/version_last_ckpt branch April 29, 2022 05:13
@akihironitta akihironitta changed the title Versioning of last checkpoins Versioning of last checkpoints Apr 29, 2022
Copy link
Contributor

@ananthsub ananthsub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a storage regression. For instance, this doubles the number of checkpoint files created when used with saving at the end of every epoch and setting save_last=True. Before, we'd have N+1 checkpoints, and now we have 2N checkpoints. The old "formerly last" checkpoints are still going to be kept around on disk.

This becomes noticeable for larger models.

The only way around this is within Lightning is to extend the ModelCheckpoint callback here and override all the hooks in order to be more performant.

@otaj
Copy link
Contributor Author

otaj commented Apr 29, 2022

This should save only one last checkpoint for a full run as long as the ModelCheckpoint callback's last_model_path does not change (which it shouldn't at the end of each epoch). Can you please show a repro so that we can fix the regression?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
callback: model checkpoint feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version suffix to last.ckpt
5 participants