Skip to content

Add SD3 segmented checkpointing support - #2957

Merged
bghira merged 1 commit into
agent/segmented-checkpointing-sanavideofrom
agent/segmented-checkpointing-sd3
Aug 3, 2026
Merged

Add SD3 segmented checkpointing support#2957
bghira merged 1 commit into
agent/segmented-checkpointing-sanavideofrom
agent/segmented-checkpointing-sd3

Conversation

@bghira

@bghira bghira commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Splits the SD3 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-sanavideo

Validation

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

@bghira
bghira requested a review from Copilot August 3, 2026 09:32
@bghira
bghira marked this pull request as ready for review August 3, 2026 09:32

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 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 optional gradient_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
bghira force-pushed the agent/segmented-checkpointing-sd3 branch 2 times, most recently from 5f3457d to fcef3c9 Compare August 3, 2026 10:45
@bghira
bghira force-pushed the agent/segmented-checkpointing-sd3 branch from fcef3c9 to 5c877ba Compare August 3, 2026 15:30
@bghira
bghira force-pushed the agent/segmented-checkpointing-sd3 branch from 5c877ba to 14f736a Compare August 3, 2026 15:32
@bghira
bghira force-pushed the agent/segmented-checkpointing-sd3 branch from 14f736a to fe50b9f Compare August 3, 2026 15:33
@bghira
bghira force-pushed the agent/segmented-checkpointing-sd3 branch from fe50b9f to f0eaa92 Compare August 3, 2026 15:35
@bghira
bghira merged commit 3504e55 into main Aug 3, 2026
@bghira
bghira deleted the agent/segmented-checkpointing-sd3 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