Add Cosmos segmented checkpointing support - #2937
Merged
Merged
Conversation
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 08:50
ecdfa21 to
7507487
Compare
bghira
marked this pull request as ready for review
August 3, 2026 08:52
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Cosmos (T2I) model-family integration for the segmented gradient checkpointing controls introduced in the stacked base PR, ensuring Cosmos is recognized by safety checks and exposes the expected model hooks.
Changes:
- Adds a segmented-checkpointing support test for
CosmosTransformer3DModel. - Allows
cosmosin safety-check allow-lists for--gradient_checkpointing_intervaland--gradient_checkpointing_segment_stride. - Wires Cosmos’ transformer forward pass to use
should_checkpoint_block(...)gated by interval/segment-stride settings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_segmented_checkpointing_model_support.py | Adds a capability/controls presence test for Cosmos segmented checkpointing support. |
| simpletuner/helpers/training/default_settings/safety_check.py | Extends safety-check allow-lists to permit interval + segment stride for the cosmos model family. |
| simpletuner/helpers/models/cosmos/transformer.py | Adds interval/stride setters and uses the shared should_checkpoint_block helper to gate checkpointing per block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+901
to
+906
| if torch.is_grad_enabled() and should_checkpoint_block( | ||
| bid, | ||
| self.gradient_checkpointing, | ||
| self.gradient_checkpointing_interval, | ||
| self.gradient_checkpointing_segment_stride, | ||
| ): |
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 09:02
7507487 to
3067731
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 10:45
d32e7c4 to
bcee787
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 15:30
bcee787 to
9e0f5f3
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 15:32
9e0f5f3 to
621fca5
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 15:33
621fca5 to
c888de5
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-cosmos
branch
from
August 3, 2026 15:35
c888de5 to
8e9047f
Compare
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.
Summary
Splits the Cosmos segmented checkpointing support model integration out of #2925.
Stack
Base branch:
agent/segmented-checkpointing-chromaValidation
.venv/bin/python -m unittest tests.test_segmented_checkpointing_model_support -v