A ComfyUI scheduler that automatically finds the optimal shift value to align your high and low sampling steps with a target sigma boundary. This eliminates the guesswork and manual calculations, and allows for precise control of the transition step.
Sigmas (σ) represent the level of noise in the image during the diffusion process. A high sigma value means there is a lot of noise (early in the sampling process), while a low sigma value means there is little noise (late in the sampling process). A scheduler generates a sequence of sigma values to guide the model from a noisy state to a clean image.
The boundary is a specific sigma value that acts as a threshold between the high-noise and low-noise stages of your workflow. It determines where the initial high-noise stage ends and the low-noise stage begins.
For example:
- A boundary of
0.875means that any sampling step with a sigma value greater than or equal to0.875is considered part of the "high-noise" stage. Steps with a sigma less than0.875are in the "low-noise" stage. - WAN models, for instance, typically use a boundary of
0.90for Image-to-Video (I2V) tasks and0.875for Text-to-Video (T2V) tasks.
Many schedulers include a shift parameter that pushes the entire sigma distribution higher or lower. Finding the correct shift value is crucial for aligning the boundary with your desired number of steps:
- Too low: The boundary may fall in the wrong place, giving you an incorrect number of high or low steps.
- Too high: You might waste steps or experience a drop in quality.
- Manual calculation: Finding the right shift value often requires complex math or tedious trial and error.
This node solves the shift problem by automating the calculations.
- Automatic Shift Calculation: Automatically finds the optimal
shiftvalue to hit your target sigma boundary. - Flexible Step Control: Use any combination of high and low steps without worrying about manual calculations.
- Multi-Stage Outputs: Provides separate sigma sequences for high-noise and low-noise sampling stages.
- Broad Sampler Compatibility: Works with most ComfyUI samplers.
- Smart Scheduler Filtering: Automatically excludes schedulers where the
shiftparameter has a minimal or no effect. - Denoise Support: Fully compatible with partial denoising workflows.
- Open ComfyUI Manager.
- Search for "ComfyUI-WanMoEScheduler".
- Click Install.
- Navigate to your ComfyUI
custom_nodesdirectory:cd ComfyUI/custom_nodes - Clone this repository:
git clone https://github.com/cmeka/ComfyUI-WanMoEScheduler.git
- Restart ComfyUI.
The WanMoEScheduler node simplifies experimenting with different step counts, allowing you to balance speed and quality effortlessly:
- Speed vs. Quality: Quickly test configurations like 4 high steps for speed and 10 low steps for quality.
- Experiment Freely: Try any combination of steps (e.g., 4+4, 2+10, 8+6) without needing to recalculate the shift value.
- Automatic Optimization: The node handles the complex calculations to find the perfect shift for your setup.
The WanMoEScheduler provides advanced sigma calculation for two-stage sampling workflows.
model: The model used for sigma calculations (can be either high or low, same result).scheduler: The sampling scheduler to use (the list is filtered to show only compatible schedulers).steps_high: The desired number of steps for the high-noise sampling stage (default: 4).steps_low: The desired number of steps for the low-noise sampling stage (default: 4).boundary: The target sigma value to separate the high and low stages (default: 0.875).interval: The step size for the shift search algorithm. A smaller value is more precise but slower (default: 0.01).denoise: The amount of noise to remove, from 0.0 (no change) to 1.0 (full denoise) (default: 1.0).
shift: The calculated optimal shift value.steps: The total number of sampling steps (steps_high+steps_low).steps_high: The number of high-noise steps (passthrough).steps_low: The number of low-noise steps (passthrough).sigmas: The complete sigma sequence for all steps.sigmas_high: The sigma sequence for the high-noise steps.sigmas_low: The sigma sequence for the low-noise steps.
- Image-to-Video (I2V):
boundaryof0.90. - Text-to-Video (T2V):
boundaryof0.875.
- Use
interval:0.01for high precision (slightly slower) or0.1for faster calculations (less precise). - If using speed LoRAs, you may need to lower their strength when increasing the number of
steps_low. - The default
boundaryof0.875is a good starting point for many general workflows, however I've had good success with higher bounraries (0.930+) and a few more high noise steps.
There are two primary ways to use this node's outputs: by feeding the sigmas directly into a custom sampler or by using the shift and steps with KSamplers.
- Connect your model (high or low) to the WanMoEScheduler node.
- If using WanVideoWrapper create a separate Load Diffusion Model or Unet Loader node and connect it (fast, won't use VRAM).
- Connect the
sigmas_highoutput to your first sampler (high-noise pass). - Connect the
sigmas_lowoutput to your second sampler (low-noise pass).
You can further divide the sampling process. For example, to split the high-noise stage:
- Follow the steps above.
- Connect the
sigmas_highoutput to aSplitSigmasnode. - Set the
stepparameter on theSplitSigmasnode to your desired split point. This will give you two separate sigma sequences from the original high-noise portion.
This method is common for standard two-pass workflows.
- Connect your model (high or low) to the WanMoEScheduler node.
- Connect the
shiftoutput to the ModelSamplingSD3 nodes (high and low) - In your first KSampler (Advanced) node (for the high-noise stage):
- Connect
steps_totalto thestepsinput. - Connect
steps_highto theend_at_stepinput.
- Connect
- In your second KSampler (Advanced) node (for the low-noise stage):
- Connect
steps_totalto thestepsinput. - Connect
steps_highto thestart_at_stepinput.
- Connect
- Important: Ensure the
schedulerselected in WanMoEScheduler is the same one selected in your KSampler (Advanced) nodes.
- Follow the steps above.
- Connect steps_high to end_at_step of the 2nd stage high noise KSampler (Advanced) node.
The node automatically filters the scheduler list to include only those that are significantly affected by the shift parameter.
- Excluded:
karras,exponential,linear_quadratic,kl_optimal,bong_tangent - Included: All other standard ComfyUI schedulers.
- Search Time: The time it takes to find the optimal shift is proportional to the
intervalvalue. A smaller interval is more precise but takes longer.
"Could not find shift" Error
- Decrease the
interval: A smaller interval may help find a valid shift value if the search space is narrow. - Check the
boundary: Your target boundary might be too high or low to be achievable with the given step counts. Try a value in the0.875to0.93range. - Verify Model Compatibility: Ensure the selected model and scheduler work together as expected.
Poor Quality Results
- Adjust
boundary: Experiment with different boundary values. The optimal value can depend on the model and desired outcome. - Change Step Ratios: Try different combinations of
steps_highandsteps_low. - Tune LoRA Strength: If using speed LoRAs, their strength may need to be adjusted to match the number of steps in each stage.
WanVideoWrapper doesn't work
- At this time only unipc, dpm++, and dpm++_sde work. The rest are "disabled" for custom schedulers/sigmas either by design or from a bug. I've created a pull request to fix it here: Fix custom sigmas for supported schedulers #1510


