Repository navigation
fix(qwen_image21): cut each CFG branch's image tail before combining them - #420
Merged
Merged
Conversation
…them The joint outputs of the two branches differ in length whenever the negative prompt and the prompt do, so the combine failed on a shape mismatch.
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.
QwenImage21TrainPipelineConfig.compute_noise_predcombined the two CFG branches before cutting the image tail off the DiT's joint text+image output. The branches' outputs differ in length whenever the prompt and the negative prompt do, so the combine failed on a shape mismatch. No recipe runs this family with CFG, which is how it went unnoticed.Split out of #419, which stacks on this branch.
What
compute_noise_preda forward that returns the image tail, so each branch is cut beforecfg_combine. Without CFG, and with equal text lengths, the result is the same as before.Tests
test_qwen_image21.py: CFG over branches with text lengths 3 and 5 combines their image tails; onmainit fails on the shape mismatch.Validation
--dmd2-teacher-guidance-scale 4.0and--diffusion-negative-prompt blurry, 2 H200. Without this commit the teacher's CFG forward fails incfg_combine("The size of tensor a (1158) must match the size of tensor b (1034)"); with it the run completes.Checklist
black,isortandruffat the pinned versions pass on the changed files