Skip to content

Add Cosmos 3 segmented checkpointing support - #2938

Merged
bghira merged 1 commit into
agent/segmented-checkpointing-cosmosfrom
agent/segmented-checkpointing-cosmos3
Aug 3, 2026
Merged

Add Cosmos 3 segmented checkpointing support#2938
bghira merged 1 commit into
agent/segmented-checkpointing-cosmosfrom
agent/segmented-checkpointing-cosmos3

Conversation

@bghira

@bghira bghira commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Splits the Cosmos 3 segmented checkpointing support model integration out of #2925.

  • applies the model-family checkpointing hooks and support flags
  • adds this family to the relevant safety-check allow-lists
  • keeps the shared runtime/docs in the base PR so this diff stays model-specific

Stack

Base branch: agent/segmented-checkpointing-cosmos

Validation

  • .venv/bin/python -m unittest tests.test_segmented_checkpointing_model_support -v
  • .venv/bin/python -m unittest tests.test_cosmos3_model -v
  • commit hooks: Black, isort, flake8, whitespace checks

@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from 727f96b to 9ccda17 Compare August 3, 2026 08:50
@bghira
bghira marked this pull request as ready for review August 3, 2026 08:52
@bghira
bghira requested a review from Copilot August 3, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Cosmos 3 into the segmented gradient-checkpointing feature surface by wiring the model’s checkpointing decision logic into the shared should_checkpoint_block helper, exposing the segment-stride setter, and extending safety-check allow-lists. Also adds targeted unit coverage to ensure Cosmos 3 advertises the expected checkpointing controls and that unpatchify preserves/propagates prediction dtypes correctly.

Changes:

  • Add gradient_checkpointing_segment_stride support to Cosmos3OmniTransformer and route layer checkpoint decisions through should_checkpoint_block(...).
  • Extend safety-check allow-lists to recognize cosmos3 for interval/segment-stride checkpointing settings.
  • Add unit tests for Cosmos 3 segmented-checkpointing capability flags and for _unpatchify_and_unpack_latents dtype behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/test_segmented_checkpointing_model_support.py Adds a Cosmos 3 capability test ensuring the model exposes interval + segment-stride checkpointing hooks.
tests/test_cosmos3_model.py Adds regression tests validating _unpatchify_and_unpack_latents preserves or adopts the materialized latent dtype.
simpletuner/helpers/training/default_settings/safety_check.py Adds cosmos3 to the checkpointing segment-stride supported model allow-list (and confirms interval support in-file).
simpletuner/helpers/models/cosmos3/transformer.py Implements segment-stride setter/state and uses shared should_checkpoint_block logic for per-layer checkpoint decisions; updates unpatchify output dtype selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from 9ccda17 to 178cd2b Compare August 3, 2026 09:02
@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from 178cd2b to aeeb013 Compare August 3, 2026 10:45
@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from aeeb013 to f2f8806 Compare August 3, 2026 15:30
@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from f2f8806 to a8ba193 Compare August 3, 2026 15:32
@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from a8ba193 to 520f70d Compare August 3, 2026 15:33
@bghira
bghira force-pushed the agent/segmented-checkpointing-cosmos3 branch from 520f70d to a97b54e Compare August 3, 2026 15:35
@bghira
bghira merged commit 3504e55 into main Aug 3, 2026
2 checks passed
@bghira
bghira deleted the agent/segmented-checkpointing-cosmos3 branch August 3, 2026 15:37
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