Skip to content

Add Flux segmented checkpointing support - #2940

Merged
bghira merged 2 commits into
agent/segmented-checkpointing-erniefrom
agent/segmented-checkpointing-flux
Aug 3, 2026
Merged

Add Flux segmented checkpointing support#2940
bghira merged 2 commits into
agent/segmented-checkpointing-erniefrom
agent/segmented-checkpointing-flux

Conversation

@bghira

@bghira bghira commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

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

  • adds Flux stride handling, attention activation offload, and FFN/offload block plumbing
  • adds Flux to the stride and attention-offload safety-check allow-lists
  • keeps shared runtime/docs in the base PR so this diff stays model-specific

Stack

Base branch: agent/segmented-checkpointing-ernie

Validation

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

@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 11168d5 to 43e165d Compare August 3, 2026 08:50
@bghira
bghira requested a review from Copilot August 3, 2026 08:53
@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 Flux-family support for the segmented-checkpointing feature set introduced in the base branch, wiring Flux’s transformer blocks into stride-based segmented checkpointing and attention activation offload, and extending the safety-check allow-lists and model-support tests accordingly.

Changes:

  • Add Flux block plumbing for attention activation offload (activation_offload_context) and propagate offload flags through checkpointed and non-checkpointed execution paths.
  • Add Flux segmented-checkpointing stride handling within the transformer block loops.
  • Extend safety-check allow-lists and add unit tests validating Flux exposes the expected checkpointing controls and block call signatures.

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 Flux coverage to the model-support assertions and verifies Flux blocks accept FFN-checkpoint and attention-offload flags.
simpletuner/helpers/training/default_settings/safety_check.py Adds flux to the segmented-stride and attention-activation-offload allow-lists.
simpletuner/helpers/models/flux/transformer.py Implements Flux attention activation offload plumbing and stride-aware segmented checkpointing behavior.
Suppressed comments (1)

simpletuner/helpers/models/flux/transformer.py:1419

  • Same issue as above: the return_dict branch in create_custom_forward does not pass offload_attention, so attention activation offload is disabled when return_dict is set.
                        if return_dict is not None:
                            return module(*inputs, return_dict=return_dict)

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

Comment on lines 1250 to 1251
if return_dict is not None:
return module(*inputs, return_dict=return_dict)
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 43e165d to 8ce0266 Compare August 3, 2026 09:02
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 828bf68 to 562eb6f Compare August 3, 2026 10:45
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 562eb6f to 3911e5c Compare August 3, 2026 15:30
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 3911e5c to d9ee1dc Compare August 3, 2026 15:32
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from d9ee1dc to 3856384 Compare August 3, 2026 15:33
@bghira
bghira force-pushed the agent/segmented-checkpointing-flux branch from 3856384 to 3316163 Compare August 3, 2026 15:35
@bghira
bghira merged commit 3504e55 into main Aug 3, 2026
@bghira
bghira deleted the agent/segmented-checkpointing-flux 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