Repository navigation
Conversation
…cap) diffusers pads every FLUX.1 T5 prompt to 512 tokens and runs T5 without an attention mask, so the padding changes the embeddings and adds 256 joint attention tokens per step. ComfyUI pads to 256 and otherwise keeps the real length. Pass max_sequence_length = clamp(T5 length incl. EOS, 256, 512) per chunk for flux.1 and flux.1-kontext, signature gated, never over an explicit value; the negative prompt counts only when true CFG encodes it.
diffusers enables Qwen-Image true CFG only when a negative prompt is passed, and Studio sends none when the box is blank, so the default guidance 4 never applied CFG. ComfyUI encodes an empty negative and applies CFG. For true_cfg_scale families with guidance above 1 and no negative, pass an empty negative; an explicit negative and guidance <= 1 are unchanged.
Default (steps, guidance) per model now match ComfyUI's official template for the same checkpoint: FLUX.1 dev / Kontext / Krea dev 20 steps (Krea dev at the FLUX guidance default 3.5), FLUX.2 dev 20, FLUX.2 klein base 20 at CFG 5, Qwen-Image-2.1 25, Qwen-Image-Edit 2511 40 at 4, Qwen-Image-2512 50 at 4, Z-Image-Turbo 8, Z-Image base 25 at 3.0 (diffusers Z-Image guidance is ComfyUI cfg - 1), SDXL 25. Backend and UI tables stay in sync; explicit request values are untouched.
ComfyUI's Ideogram 4 template samples 20 steps at constant guidance 7 with the logit-normal schedule at mu 0.5 / std 1.75. Default to 20 / 7 and pass those schedule parameters whenever guidance is constant; an explicit 48 steps at 7 still runs the card's tapered schedule with the pipeline's own mu / std.
ComfyUI's official templates sample Wan2.2-TI2V-5B at 20 steps / CFG 5, Wan2.2-T2V-A14B at 20 steps / CFG 3.5 (Lightning LoRA off) and HunyuanVideo-1.5 at 20 steps / CFG 6, against Studio's 50-step defaults. Match them in the family defaults, the per-variant table (A14B now has its own key ahead of the generic Wan one) and the UI table. Explicit values are unchanged.
…shift The shipped schedulers shift sigmas differently from ComfyUI's defaults for the same models: Qwen-Image / Qwen-Image-Edit resolve a dynamic exponential shift (about 2.0 at 1024 px) with a 0.02 terminal stretch against a constant 3.1, Z-Image base ships 6.0 against 3.0, Wan2.2 TI2V-5B / T2V-A14B ship 5.0 / 3.0 against 8 / 5, HunyuanVideo-1.5 480p / 720p ship 5.0 / 9.0 against 7. Add a per-family comfy_flow_shift and rebuild the scheduler at load with that static shift (no dynamic mu, no terminal stretch). Families without the field keep their shipped scheduler.
The template's scheduler widgets are stale: steps / mu / std come from the 'Default' preset (20 / 0.0 / 1.75), and a CFG override in the model path drops guidance 7 to 3 over the sampling range 0.7 to 1.0, which on the shift-1 flow model is sigma <= 0.3. Use mu 0.0 / std 1.75 and, at the default guidance 7, pass a per-step guidance_schedule of 7 then 3 on exactly the steps whose logit-normal sigma is <= 0.3 (last 3 of 20 at 1024^2). Other guidance values stay constant; an explicit 48 / 7 keeps the card taper.
Every distinct T5 length is a new denoiser shape. On the compiled default path with CUDA graphs, exact lengths cost a 14 s recompile for the first length past 256 and a 0.4 to 1 s graph capture for each further one, until the 4-graph cap made later shapes (resolution changes included) run eager. Keep ComfyUI's 256 for prompts up to 256 tokens and pad longer ones to 512, the old behaviour: two shapes per resolution. This deviates from ComfyUI's exact length for 257 to 512 token prompts only (unmasked padding changes their embeddings slightly).
The shared Z-Image default is now diffusers' g = 3 (ComfyUI cfg 4), but sd-cli takes --cfg-scale as standard CFG, so the native engine sampled Z-Image base at cfg 3. Pass g + 1 for Z-Image; Turbo's 0 still turns CFG off.
Resolve test_diffusion_backend.py by keeping both appended blocks: main's GGUF offload-swap tests and this branch's FLUX T5, Qwen negative, Ideogram and flow-shift tests.
Owner
Author
|
Source PR unslothai#12516 was merged; closing this staging PR. |
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.
Staging-only CI validation for unslothai#12516.
This PR exists only to run fork GitHub Actions checks and should be closed after validation.