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

Add checkpoint load step #716

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Add checkpoint load step #716

merged 3 commits into from
Dec 5, 2024

Conversation

msaroufim
Copy link
Member

@msaroufim msaroufim commented Dec 4, 2024

Fixes #662

followed @fegin advice to test this and indeed things are working https://gist.github.com/msaroufim/2925b3f17b631bf370a49f185b6e169d

[checkpoint]
enable_checkpoint = true
folder = "checkpoint"
interval_type = "steps"
interval = 10
model_weights_only = false
export_dtype = "float32"
async_mode = "disabled" # ["disabled", "async", "async_with_pinned_mem"]
load_step = 10

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 4, 2024
Copy link
Contributor

@tianyu-l tianyu-l left a comment

Choose a reason for hiding this comment

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

Thanks! It'd be great to also update docs/checkpoint.md

Comment on lines 486 to 488
default=0,
help="Load the checkpoint at the specified step. If 0, load the latest checkpoint.",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@fegin
Copy link
Contributor

fegin commented Dec 4, 2024

You can just run a local script and checkpoint every 10 steps and then load again from 20th step. The logging should show the training starts from 20th step. If load_step is not used, it should just load the checkpoint and finish the training.

@tianyu-l
Copy link
Contributor

tianyu-l commented Dec 4, 2024

You can just run a local script and checkpoint every 10 steps and then load again from 20th step. The logging should show the training starts from 20th step. If load_step is not used, it should just load the checkpoint and finish the training.

@fegin I think the original ask in #662 was to resume from a particular step, not necessarily the latest one.

@fegin
Copy link
Contributor

fegin commented Dec 4, 2024

What I meant is that if load_step is not specified, the training won't happen because the trainer will just load the last step checkpoint. But if load_step is implemented appropriately, and we specify some intermediate step, like 20, the logging should start from 20. This can be used to verify the implementation.

@tianyu-l
Copy link
Contributor

tianyu-l commented Dec 5, 2024

oh I was assuming Mark's point was how to write a light-weight unit test for it. I think it is not blocking as unit tests for checkpointing in general are missing. I think it's worth updating the checkpoint.md though.

@msaroufim msaroufim requested review from fegin and tianyu-l December 5, 2024 19:32
Copy link
Contributor

@tianyu-l tianyu-l left a comment

Choose a reason for hiding this comment

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

thanks!
Before merge, can you also help update the how-to in docs/checkpoint.md with one more bullet point?

@msaroufim
Copy link
Member Author

thanks!
Before merge, can you also help update the how-to in docs/checkpoint.md with one more bullet point?

Added it, I can do another PR to better document checkpoint.md since right now it just lists configs

@msaroufim msaroufim merged commit afa8229 into main Dec 5, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Config] Make the checkpoint step configurable.
4 participants