segmented checkpointing for better cache hits / latency - #2920
Open
bghira wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces segmented (chunked) gradient checkpointing for the Flux and MageFlow transformer models, enabling more efficient memory and computation trade-offs during training. It updates both the implementation and documentation across multiple languages to clarify how the new chunked checkpointing works and which models support it.
Segmented Gradient Checkpointing Implementation:
flux/transformer.pyandmageflow/transformer.py, using the newcheckpoint_sequential_stateutility. This allows for more flexible and efficient memory usage during training. [1] [2] [3] [4]set_gradient_checkpointing_intervalmethod and thegradient_checkpointing_intervalattribute to MageFlow, aligning its interface with Flux for chunked checkpointing. [1] [2]gradient_checkpointing_interval.pyutility to support the new chunked checkpointing logic.Documentation Updates:
--gradient_checkpointing_intervalnow checkpoints contiguous chunks of blocks, and clarified the impact of higher values on memory and recompute. [1] [2] [3] [4] [5] [6]These changes make gradient checkpointing more efficient and flexible, and ensure that both the code and documentation accurately reflect the new capabilities.