Add SD3 segmented checkpointing support - #2957
Merged
bghira merged 1 commit intoAug 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Stable Diffusion 3 (SD3) to the project’s “segmented checkpointing” and attention-activation-offload feature set, wiring SD3 into the same model-family support and safety gates introduced in the base stacked PR.
Changes:
- Implements SD3 segmented checkpointing via
checkpoint_sequential_state, including optionalgradient_checkpointing_segment_stride. - Adds SD3 attention activation offload support (
activation_offload_context) and marks the model as supporting it. - Extends unit tests to cover SD3 segmented checkpointing behavior and offload-context usage, and updates safety-check allow-lists.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_transformers/test_sd3_transformer.py | Adds SD3 unit tests ensuring segmented checkpointing uses checkpoint_sequential_state and that attention offload context is invoked. |
| tests/test_segmented_checkpointing_model_support.py | Registers SD3 in the model-level “checkpointing controls supported” test matrix (interval/stride/offload/attention-offload). |
| simpletuner/helpers/training/default_settings/safety_check.py | Adds "sd3" to the allow-lists for interval/stride checkpointing and attention activation offload. |
| simpletuner/helpers/models/sd3/transformer.py | Adds SD3 segmented checkpointing + segment stride plumbing and wraps SD3 attention calls with activation_offload_context. |
| simpletuner/helpers/models/sd3/expanded.py | Updates _set_gradient_checkpointing signature and behavior to match the recursive enabling pattern used elsewhere, and broadens backend detection to startswith("unsloth"). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bghira
force-pushed
the
agent/segmented-checkpointing-sd3
branch
2 times, most recently
from
August 3, 2026 10:45
5f3457d to
fcef3c9
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-sd3
branch
from
August 3, 2026 15:30
fcef3c9 to
5c877ba
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-sd3
branch
from
August 3, 2026 15:32
5c877ba to
14f736a
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-sd3
branch
from
August 3, 2026 15:33
14f736a to
fe50b9f
Compare
bghira
force-pushed
the
agent/segmented-checkpointing-sd3
branch
from
August 3, 2026 15:35
fe50b9f to
f0eaa92
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 SD3 segmented checkpointing support model integration out of #2925.
Stack
Base branch:
agent/segmented-checkpointing-sanavideoValidation
.venv/bin/python -m unittest tests.test_segmented_checkpointing_model_support -v.venv/bin/python -m unittest tests.test_transformers.test_sd3_transformer -v