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

split restore_training_state into logical parts [2 / 2] #7900

Merged
merged 9 commits into from
Jun 10, 2021

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Jun 9, 2021

What does this PR do?

Part of #7652 and
follow up to #7901 will be updated after #7901 merged!

Splits restore_training_state into the following pieces:

restore_callbacks()
restore_progress()
restore_optimizers()
restore_lr_schedulers()

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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read 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 🙃

@awaelchli awaelchli changed the title Split restore_training_state into logical parts [1/2] Split restore_training_state into logical parts Jun 9, 2021
@awaelchli awaelchli changed the title Split restore_training_state into logical parts split CheckpointConnector.restore_training_state into logical parts Jun 9, 2021
@codecov
Copy link

codecov bot commented Jun 9, 2021

Codecov Report

Merging #7900 (5d65f4b) into master (d209b68) will decrease coverage by 0%.
The diff coverage is 88%.

@@          Coverage Diff           @@
##           master   #7900   +/-   ##
======================================
- Coverage      92%     92%   -0%     
======================================
  Files         200     200           
  Lines       12837   12816   -21     
======================================
- Hits        11857   11832   -25     
- Misses        980     984    +4     

@awaelchli awaelchli changed the title split CheckpointConnector.restore_training_state into logical parts split CheckpointConnector.restore_training_state into logical parts Jun 9, 2021
@awaelchli awaelchli added this to the v1.4 milestone Jun 9, 2021
@awaelchli awaelchli changed the title split CheckpointConnector.restore_training_state into logical parts split restore_training_state into logical parts Jun 9, 2021
@awaelchli awaelchli changed the title split restore_training_state into logical parts split restore_training_state into logical parts [2 / 2] Jun 9, 2021
@awaelchli awaelchli added checkpointing Related to checkpointing feature Is an improvement or enhancement labels Jun 9, 2021
@awaelchli awaelchli force-pushed the feature/resume-6-2 branch from 80eaec9 to ff8f9b7 Compare June 10, 2021 15:16
@awaelchli awaelchli changed the base branch from master to feature/resume-6-1 June 10, 2021 15:18
@awaelchli awaelchli changed the base branch from feature/resume-6-1 to master June 10, 2021 15:18
@awaelchli awaelchli marked this pull request as ready for review June 10, 2021 15:50
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

Neat !

@awaelchli awaelchli requested a review from carmocca June 10, 2021 16:37
@awaelchli awaelchli enabled auto-merge (squash) June 10, 2021 16:41
@awaelchli awaelchli added the ready PRs ready to be merged label Jun 10, 2021
@awaelchli awaelchli merged commit c1eac48 into master Jun 10, 2021
@awaelchli awaelchli deleted the feature/resume-6-2 branch June 10, 2021 19:54
Comment on lines +143 to +144
if not checkpoint:
return
Copy link
Contributor

Choose a reason for hiding this comment

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

when can this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when Trainer(resume_from_checkpoint=None)
(the default case)
then trainer calls restore() and we do a no-op

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we skip calling restore at all in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no because it's actually an attempt to restore.
this is the sequence:

  1. attempt to restore from hpc_checkpoint file
  2. attempt to restore from resume_from_checkpoint path if provided
  3. do nothing

and could rename restore to attempt_restore if that's better?

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

Successfully merging this pull request may close these issues.

5 participants