Nodes/ComfyUI-EulerDiscreteScheduler/FlowMatch Euler Discrete Scheduler (Custom)
ComfyUI Node

FlowMatch Euler Discrete Scheduler (Custom)

The Z-Image scheduler ComfyUI forgot to ship

By erosDiffusion·Created 8 months ago·Updated 8 months ago· 414
FlowMatch Euler Discrete Scheduler (Custom)
    • sigmas
    steps9
    start_at_step0
    end_at_step9999
    base_image_seq_len256
    base_shift0.50
    invert_sigmasdisable
    max_image_seq_len8192
    max_shift1.15
    num_train_timesteps1000
    shift3.00
    shift_terminal0.00
    stochastic_samplingdisable
    time_shift_typeexponential
    use_beta_sigmasdisable
    use_dynamic_shiftingdisable
    use_exponential_sigmasdisable
    use_karras_sigmasdisable
    deviceauto

    If you're running Z-Image Turbo and your 9-step outputs come out a touch soft or noisy, this is the node the author built to fix exactly that. The pitch on the pack is blunt: "9 steps, big res, zero noise." The reason it exists is smaller than it sounds - ComfyUI ships a long list of schedulers, but not FlowMatchEulerDiscrete, which happens to be the exact scheduler the official Z-Image diffusers demo runs. erosDiffusion just wired the diffusers one into ComfyUI so you can actually use it.

    The pack does that two ways. It registers a plain FlowMatchEulerDiscreteScheduler entry in the KSampler dropdown - pick it, run, done. And it gives you this node, the Custom one, which exposes every parameter of the diffusers scheduler and outputs SIGMAS for the SamplerCustom node. This is the tinkerer's path: more knobs, more rope.

    How it works

    Z-Image, Flux, Chroma, Qwen-Image - everything since SD3 - are flow-matching (rectified-flow) models. Instead of predicting the noise on a curved trajectory the SD 1.5 way, they learn a near-straight line from noise to image. That single property is why they run in 4-9 steps instead of 20-50, and it's also why old scheduler habits break on them: there's very little for a clever noise curve to correct, and a lot for it to distort.

    A scheduler's whole job is to hand the sampler the list of noise levels - the sigmas - to walk through. This node builds that list the diffusers way, matched to how Z-Image was actually demoed, rather than approximating it with a stock ComfyUI schedule. Feed the sigmas to a SamplerCustom running Euler and you get the model's intended sampling path.

    The inputs and outputs that matter

    Everything is a widget here - there are no conditioning sockets, just numbers going in and one SIGMAS output going out. The few that earn your attention:

    • steps - defaults to 9, which is the Z-Image Turbo home range. More isn't better on a distilled model; past ~9 you usually lose quality, not gain it.
    • shift - defaults to 3, and this is the lever that matters most. It's the same timestep-shift idea as ModelSamplingAuraFlow: it decides how sampling effort splits between composition and fine detail. It's model-specific, and the community consensus for Z-Image Turbo is that it wants a higher value than ComfyUI's default of 3 - people land around 7. If your images look soft, raise this before touching anything else.
    • start_at_step / end_at_step - trim the schedule to a slice. Added so you can drive image-to-image or restart/refine passes off a partial sigma list instead of the full one.

    The rest - use_dynamic_shifting with its base_shift/max_shift/base_image_seq_len/max_image_seq_len companions, num_train_timesteps, time_shift_type, shift_terminal, invert_sigmas, stochastic_sampling, device (leave on auto) - are faithful mirrors of the diffusers config. You can safely ignore them until you have a specific reason not to.

    Wire the sigmas output into SamplerCustom's sigmas input, pair it with an Euler sampler, and you've replaced the built-in scheduler entirely.

    Installing it

    Two ways. In ComfyUI Manager, search erosDiffusion (or ComfyUI-EulerFlowMatchingDiscreteScheduler), install, restart. Or from a terminal: cd ComfyUI/custom_nodes && git clone https://github.com/erosDiffusion/ComfyUI-EulerDiscreteScheduler.git, then restart ComfyUI. No model files to download - it's a scheduler, not a checkpoint.

    Where people get burned

    • Don't flip the karras or exponential sigma switches. The node exposes use_karras_sigmas and use_exponential_sigmas because diffusers does - but on flow-matching models those two are universal failures, not just weaker choices. The biggest sampler sweep in the community (62 samplers, 16 schedulers on Z-Image Turbo) found them breaking across the board. Leave them disabled. use_beta_sigmas is the one that's actually safe to experiment with.
    • The scheduler vanishes when RES4LYF is installed. This is the pack's best-known conflict, and RES4LYF is everywhere these days, so it hits a lot of people. The plain KSampler entry stops appearing in the dropdown. Cleanest fix: just use this Custom node into SamplerCustom, which sidesteps the dropdown entirely. Otherwise the README suggests wiring a BasicScheduler through a SamplerCustom, or disabling RES4LYF if you don't need it. The 1.0.8 update tried to patch the collision directly.
    • Install fails on peft. A few users hit a version mismatch on the peft package at startup. Check your ComfyUI startup log and pin the version it asks for.
    Categorysampling/schedulers

    Inputs (18)

    NameTypeDefaultDescription
    stepsINT91–10000Total number of diffusion steps to generate the full sigma schedule.
    start_at_stepINT00–10000The starting step (index) of the sigma schedule to use. Set to 0 to start at the beginning (first step).
    end_at_stepINT99990–10000The ending step (index) of the sigma schedule to use. Set higher than 'steps' to use all steps.
    base_image_seq_lenINT256Base sequence length for dynamic shifting. Should match model's training resolution (e.g., 256 for 512x512 images).
    base_shiftFLOAT0.50Stabilizes generation. Higher values = more consistent/predictable outputs. Z-Image-Turbo uses default 0.5.
    invert_sigmasCOMBOdisableReverses the sigma schedule. Keep disabled unless experimenting with advanced techniques.
    max_image_seq_lenINT8192Maximum sequence length for dynamic shifting. Affects how the scheduler adapts to large images.
    max_shiftFLOAT1.15Maximum variation allowed. Higher = more exaggerated/stylized results. Z-Image-Turbo uses default 1.15.
    num_train_timestepsINT1000Timesteps the model was trained with. Should match your model's config (typically 1000).
    shiftFLOAT3.00Global timestep schedule shift. Z-Image-Turbo uses 3.0 for optimal performance with the Turbo model.
    shift_terminalFLOAT0.00End value for shifted schedule. Set to 0.0 to disable. Advanced parameter for timestep schedule control.
    stochastic_samplingCOMBOdisableAdds controlled randomness to each step. Enable for more varied outputs (similar to ancestral samplers).
    time_shift_typeCOMBOexponentialMethod for resolution-dependent shifting. Use 'exponential' for most cases, 'linear' for experiments.
    use_beta_sigmasCOMBOdisableUses beta distribution for sigmas. Experimental alternative noise schedule.
    use_dynamic_shiftingCOMBOdisableAuto-adjusts timesteps based on image resolution. Z-Image-Turbo disables this for consistent Turbo performance.
    use_exponential_sigmasCOMBOdisableUses exponential sigma spacing. Try enabling for different noise distribution characteristics.
    use_karras_sigmasCOMBOdisableUses Karras noise schedule for smoother results. Similar to DPM++ samplers, often improves quality.
    deviceCOMBOautoDevice for sigma computation. 'auto' detects GPU if available, otherwise CPU. Using GPU avoids CPU->GPU transfers.

    Outputs (1)

    NameTypeDescription
    sigmasSIGMAS