refactor Flux transformer to use scanned blocks, dynamic checkpointing, and decoupled projections#417
Open
prishajain1 wants to merge 1 commit into
Open
refactor Flux transformer to use scanned blocks, dynamic checkpointing, and decoupled projections#417prishajain1 wants to merge 1 commit into
prishajain1 wants to merge 1 commit into
Conversation
4696256 to
11ddfef
Compare
|
🤖 Hi @prishajain1, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @prishajain1, but I was unable to process your request. Please see the logs for more details. |
Perseus14
requested changes
Jun 12, 2026
8c8dcec to
f58fb9e
Compare
…ng, and weight loading improvements
f58fb9e to
b53d7d2
Compare
|
🤖 Hi @Perseus14, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 Hi @Perseus14, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @Perseus14, but I was unable to process your request. Please see the logs for more details. |
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.
Overview
This PR refactors the Flux model architecture in MaxDiffusion to support scanned blocks (nn.scan) for double and single blocks, implements configurable gradient checkpointing (rematerialization) policies, and updates the weights loader to support loading pretrained checkpoints under the scanned format.
Key Changes
MlpAndOutputBlockwrapper) to eliminate redundant recomputation of attention and projection outputs.jnp.splitacross Flux transformer blocks for cleaner layout constraints.nn.scanto optimize compiler tracing and step execution speed on TPUs.FLUX_OPTIMIZEDtoGradientCheckpointTypeto allow configuring block-specific rematerialization policies dynamically via configuration files instead of being hardcoded.util.py) to slice, group, and stack PyTorch checkpoint weights along axis 0 to match the expected format ofnn.scanlayers.