Nodes/ComfyUI-sonar/SamplerSonarEulerA
ComfyUI Node

SamplerSonarEulerA

The ancestral Sonar the author actually recommends

By blepping·Created 3 years ago·Updated 12 days ago· 49
SamplerSonarEulerA
  • guidance_cfg_opt
  • custom_noise_opt
  • SAMPLER
momentum0.950
momentum_hist0.750
momentum_initZERO
direction1.000
rand_init_noise_typegaussian
s_noise1.000
eta1.000
noise_typegaussian

If you ask the author of ComfyUI-sonar which momentum sampler to start with, this is the one. "I personally recommend using the custom sampler approach and the ancestral version," the README says, and this node is that recommendation in node form: ancestral Euler with a momentum history layered on top.

Ancestral samplers - Euler a, DPM++ SDE - add a little fresh noise at each step, which is why they never quite settle the way converging samplers do. Same seed, more steps, and the image keeps drifting instead of refining. That's a feature when you want variety and character, which is most of the time when you're generating for fun rather than debugging. Momentum sampling adds a running history of where the denoising direction has been pointing, then blends it in each step, which smooths out some of the chaos that pure ancestral Euler gets up to.

The inputs that matter

It has the same core momentum controls as its plain sibling (momentum, momentum_hist, momentum_init, direction, rand_init_noise_type - same defaults of 0.95 / 0.75, and momentum = 1.0 disables momentum entirely), plus the two ancestral knobs:

  • s_noise (default 1) - multiplier for the noise added during ancestral sampling. Turn it down if output gets grainy at higher steps.
  • eta (default 1) - basically controls how ancestral the sampler is. 0 gives you a non-ancestral (or SDE) sampler.
  • noise_type (default gaussian) - which noise family feeds those per-step ancestral injections. This is where the pack's noise toybox starts to matter: switch to brownian or a pyramid variant and the character of the image changes even though the sampler math doesn't.

There's also an optional guidance_cfg_opt socket for extended guidance parameters, and an optional custom_noise_opt if you build a custom noise chain - when that's connected it overrides noise_type entirely.

How to wire it

The node outputs a SAMPLER socket, so it goes into the custom sampling pipeline: SamplerCustomAdvanced + BasicScheduler, or a CFGGuider into SamplerCustom. If you want momentum active only part of the way through a generation, or you want the denoised momentum mode, hang a SamplerConfigOverride off the chain - you can pass YAML to set momentum_start_step and momentum_end_step, or switch momentum_mode between classic, new, and denoised.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/blepping/ComfyUI-sonar

or search "ComfyUI-sonar" in ComfyUI Manager and restart. No models to download. The same pack-level caveats apply everywhere in this repo: inputs change between revisions (track your git hash if you want reproducible gens), and seeds aren't guaranteed portable across GPUs because some noise generation happens on CPU.

Where people get burned

The predictable ancestral trap is expecting determinism. If you're A/B testing a setting change, use a converging sampler instead - this one will keep throwing you off with noise variance. And if output ever looks mushy, s_noise is the first dial to try, before you go hunting in the momentum knobs.

Categorysampling/custom_sampling/samplers

Inputs (10)

NameTypeDefaultDescription
momentumFLOAT0.950-0.5–2.5How much of the normal result to keep during sampling. 0.95 means 95% normal, 5% from history. When set to 1.0 effectively disables momentum.
momentum_histFLOAT0.750-1.5–1.5How much of the existing history to leave at each update. 0.75 means keep 75%, mix in 25% of the new result.
momentum_initCOMBOZEROInitial value used for momentum history. ZERO - history starts zeroed out. RAND - History is initialized with a random value. SAMPLE - History is initialized from the latent at the start of sampling.
directionFLOAT1.000-30–15Multiplier applied to the result of normal sampling.
rand_init_noise_typeCOMBOgaussianNoise type to use when momentum_init is set to RANDOM.
s_noiseFLOAT1.000-10000–10000Multiplier for noise added during ancestral or SDE sampling.
etaFLOAT1.000-10000–10000Basically controls the ancestralness of the sampler. When set to 0, you will get a non-ancestral (or SDE) sampler.
noise_typeCOMBOgaussianNoise type used during ancestral or SDE sampling. Only used when the custom noise input is not connected.
guidance_cfg_optoptSONAR_GUIDANCE_CFGOptional input for extended guidance parameters.
custom_noise_optoptSONAR_CUSTOM_NOISE,OCS_NOISEOptional input for custom noise used during ancestral or SDE sampling. When connected, the built-in noise_type selector is ignored. The following input types are supported: SONAR_CUSTOM_NOISE, OCS_NOISE

Outputs (1)

NameTypeDescription
SAMPLERSAMPLER