qwen_image: fixes for TREAD - #2459
Merged
Merged
Conversation
samzhang996-hue
pushed a commit
to samzhang996-hue/SimpleTuner
that referenced
this pull request
Apr 27, 2026
qwen_image: fixes for TREAD
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.
This pull request adds and enhances support for the TREAD routing method in the Qwen Image model and transformer, including improved handling of routing logic and expanded test coverage. The main changes are grouped below.
TREAD Integration in Qwen Image Model
tread_initmethod to theQwenImagemodel that initializes TREAD routing, validates configuration, and sets up the router with the specified routes.Improved TREAD Routing Logic in Transformer
QwenImageTransformer2DModel'sforwardmethod to pre-normalize route indices (including handling negative indices), and to clearly delineate when to start and end a route usingroute_ptrandrouting_nowstate variables. This makes the routing process more robust and easier to follow. [1] [2] [3]Expanded Test Coverage
tread_initmethod behaves as expected. [1] [2]