Repository navigation
fix(qwen-image): hold the dynamic shift at the end of its fit - #9892
Merged
joshistoast merged 5 commits intoOct 19, 2026
Merged
Conversation
Above the scheduler config's max_image_seq_len (about 1448x1448 for the stock config) mu stays at max_shift instead of extrapolating. The Qwen-Image docs explain the hold and how Shift reproduces the previous schedule.
6 of 7 tasks
joshistoast
approved these changes
Oct 19, 2026
joshistoast
enabled auto-merge (squash)
October 19, 2026 01:24
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
Qwen-Image sets its noise-schedule shift (mu) from the image's token count. It draws a line through two points from the scheduler config: 256 tokens give 0.5, and 8192 tokens (about 1448×1448 of area, 2.1 MP) give 0.9. Above 8192 tokens the line kept climbing.
qwen_image_denoisenow holds mu at the end of the fit, as the FLUX.1, Z-Image and LTX-2 fits already do (Krea-2 Raw: #9887).scheduler/scheduler_config.json.shift(Lightning LoRAs) still wins.Why now: at 4096², an image-to-image pass at strength 0.5 starts from almost pure noise (sigma 0.95), so it replaces the image instead of refining it. The Upscale widget's Qwen-Image entry, which comes next, needs mid-range starts at 2048²–4096².
How other implementations handle this:
supported_models.py,QwenImage.sampling_settings).QwenImagePipelineextrapolates like the old code.Other changes:
scheduler.configinstead of.get(key, default). The scheduler registers every init argument, so those defaults never applied, and themax_shiftdefault (0.9) did not match the scheduler's real one (1.15). The comment now names the real defaults.shiftdescription now says where the hold starts.Related Issues / Discussions
Same fix as #9887 (Krea-2 Raw) and the Z-Image shift hold. It is a prerequisite for Qwen-Image in the Upscale widget (follow-up to #9825 and #9889).
Qwen-Image-2.1 (#9784) has its own
calculate_muwith the same fit, and it still extrapolates. Not touched here.QA Instructions
Automated
pytest tests/app/invocations/test_qwen_image_denoise.py tests/app/invocations/test_qwen_image_packed_models.py: 34 passed._run_diffusionwith the realFlowMatchEulerDiscreteSchedulerand read mu where it reachesset_timesteps. Expected values are hand-computed.scheduler_config.jsonholds at its own end.mu = ln(shift)at 4096².scheduler_config.jsonpath.ruff@0.11.2 check/format --check: pass.openapi.jsonandschema.tsare regenerated; only the field description and the version change.Text-to-image A/B (RTX 4090, Qwen Image 2512 Q4_K_M GGUF, Qwen2.5-VL fp8 encoder, 2048², 40 steps, CFG 4, model cache emptied before each run, held and old mu interleaved per seed; the old mu is passed through
shift = e^1.3129 = 3.717):No image shows doubled subjects, broken lettering or a damaged composition.
Review
No material findings. Resolved: the docs now say that Shift on this node is e^mu, not mu as on Krea-2, and which value gives back the old schedule.
Remaining: the low end still extrapolates below 256 tokens, as the FLUX.1, Z-Image and Krea-2 fits do.
Compatibility / Rollout
shift.Checklist
What's Newcopy (if doing a release after this PR)Need help on this PR? Tag
@codesmith-botwith what you need.