Skip to content

Add AuraFlow segmented checkpointing support - #2934

Merged
bghira merged 2 commits into
agent/segmented-checkpointing-ace-stepfrom
agent/segmented-checkpointing-auraflow
Aug 3, 2026
Merged

Add AuraFlow segmented checkpointing support#2934
bghira merged 2 commits into
agent/segmented-checkpointing-ace-stepfrom
agent/segmented-checkpointing-auraflow

Conversation

@bghira

@bghira bghira commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Splits the AuraFlow segmented-checkpointing integration out of #2925.

  • adds AuraFlow segment-stride checkpoint selection
  • updates AuraFlow ControlNet for unsloth backend matching
  • adds AuraFlow to the stride safety-check allow-list

Stack

Base branch: agent/segmented-checkpointing-ace-step

Validation

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

@bghira
bghira force-pushed the agent/segmented-checkpointing-auraflow branch from 8bb396b to 064d276 Compare August 3, 2026 08:50
@bghira
bghira requested a review from Copilot August 3, 2026 08:51
@bghira
bghira marked this pull request as ready for review August 3, 2026 08:53

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 AuraFlow support for segmented (stride-window) gradient checkpointing, aligning AuraFlow’s transformer checkpointing behavior with the shared segmented-checkpointing helpers and expanding safety-check allow-list coverage.

Changes:

  • Add gradient_checkpointing_segment_stride plumbing to AuraFlowTransformer2DModel and use should_checkpoint_block(...) to decide per-block checkpointing.
  • Treat unsloth-* checkpoint backends consistently (e.g., unsloth-ffn) across AuraFlow transformer and ControlNet.
  • Extend tests and the safety-check allow-list to cover AuraFlow segmented checkpointing controls.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_transformers/test_auraflow_transformer.py Adds a backward regression test covering joint + single block checkpointing.
tests/test_segmented_checkpointing_model_support.py Asserts AuraFlow exposes segmented checkpointing control setters.
simpletuner/helpers/training/default_settings/safety_check.py Adds AuraFlow to the segment-stride allow-list.
simpletuner/helpers/models/auraflow/transformer.py Implements segment-stride checkpoint selection and forwards attention_kwargs through checkpointed blocks.
simpletuner/helpers/models/auraflow/controlnet.py Updates unsloth backend matching, but checkpointed paths still don’t forward attention_kwargs (see comments).
Suppressed comments (1)

simpletuner/helpers/models/auraflow/controlnet.py:417

  • Same issue in the single-block checkpointed path: create_custom_forward(block) calls the block positionally, so attention_kwargs is omitted while the non-checkpoint path passes it. This can make outputs differ depending on whether checkpointing is enabled. Wrap the block with a custom_forward that forwards attention_kwargs.
                    def create_custom_forward(module):
                        def custom_forward(*inputs):
                            return module(*inputs)

                        return custom_forward

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

Comment on lines 375 to 379
@@ -378,7 +378,7 @@ def custom_forward(*inputs):

return custom_forward
@bghira
bghira force-pushed the agent/segmented-checkpointing-auraflow branch 2 times, most recently from 0b2742e to b01c83c Compare August 3, 2026 09:31
@bghira
bghira force-pushed the agent/segmented-checkpointing-auraflow branch from b01c83c to b7de9cb Compare August 3, 2026 10:45
@bghira
bghira force-pushed the agent/segmented-checkpointing-auraflow branch from b7de9cb to 28c9690 Compare August 3, 2026 15:30
@bghira
bghira force-pushed the agent/segmented-checkpointing-auraflow branch from 28c9690 to aebc5f3 Compare August 3, 2026 15:32
@bghira
bghira merged commit 7dfe469 into main Aug 3, 2026
2 checks passed
@bghira
bghira deleted the agent/segmented-checkpointing-auraflow branch August 3, 2026 15:38
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