-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix recompute checkpointing + training CGs #3919
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -639,6 +639,13 @@ def checkpoint( | |
| ) -> _R: | ||
| """Checkpoint a model or part of the model. | ||
| This has been directly copied from torch.utils.checkpoint.""" | ||
| from megatron.core.transformer.cuda_graphs import is_graph_capturing, is_graph_warmup | ||
|
|
||
| # Skip checkpointing during CUDA graph warmup and capture, matching the behavior of | ||
| # CheckpointWithoutOutput. The graph captures all ops directly; recomputation cannot | ||
| # run inside a captured graph. | ||
| if is_graph_warmup() or is_graph_capturing(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesnt this just disable recomputation during graph capture?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this only disables recomputation during graph capture. That's where I'm seeing errors in Subsequent training passes seem to run fine. |
||
| return function(*args) | ||
| return CheckpointFunction.apply(function, distribute_saved_activations, *args) | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.