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

New activation checkpointing #343

Merged
merged 8 commits into from
Oct 27, 2023
Merged

New activation checkpointing #343

merged 8 commits into from
Oct 27, 2023

Conversation

dirkgr
Copy link
Member

@dirkgr dirkgr commented Oct 26, 2023

The checkpoint wrapper stuff is undocumented in torch. It breaks the way we construct parameter groups. This new way is documented, and, I think, easier to understand.

@dirkgr dirkgr requested a review from epwalsh October 26, 2023 20:36
@@ -853,6 +854,11 @@ class TrainConfig(BaseConfig):
Stop at a specific step.
"""

activation_checkpointing: bool = False
Copy link
Member

Choose a reason for hiding this comment

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

We already have this field

olmo/config.py Outdated
@@ -404,6 +404,12 @@ class ModelConfig(BaseConfig):
See :data:`TrainConfig.precision` instead.
"""

activation_checkpointing: bool = False
Copy link
Member

Choose a reason for hiding this comment

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

When this gets set to true during training this could cause issues later when loading the model for inference since. Instead maybe we have a method on the model like Olmo.enable_activation_checkpointing()? The trainer calls that when TrainConfig.activation_checkpointing is true, so we don't need to add a configuration option to ModelConfig`.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see why it would cause issues for inference, as the resulting checkpoint files should be 100% identical.

But I like this other design anyways.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

What I mean is that it would enable activation checkpointing when the model is loaded for inference

Copy link
Member

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

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

LGTM!

@dirkgr dirkgr merged commit 5c64338 into main Oct 27, 2023
10 checks passed
@dirkgr dirkgr deleted the ActivationCheckpointing branch October 27, 2023 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants