Nodes/ComfyUI-sonar/SamplerSonarDPMPPSDE
ComfyUI Node

SamplerSonarDPMPPSDE

Momentum bolted onto DPM++ SDE, and it kind of works

By blepping·Created 3 years ago·Updated 9 days ago· 49
SamplerSonarDPMPPSDE
  • 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_typebrownian

This is the sampler the pack's author admits might not be correct, then immediately confesses to loving anyway. "It may not work correctly but you can sample stuff with it and get interesting results. I actually really like this one." That's the whole vibe of ComfyUI-sonar in one node: momentum-based sampling grafted onto DPM++ SDE, with the author's own disclaimer that the implementation is a best-effort port of the original A1111 Sonar behavior.

DPM++ SDE is the stochastic workhorse of the DDPM-style world - it's the SDE in that 62-sampler sweep's euler_a or dpmpp_sde recommendation for Z-Image Turbo, and the ancestral/DPM family in general shows up all over sampler advice for SD 1.5/SDXL. Adding momentum to it means the step direction keeps a running history instead of reacting purely to the current noise level. The result is a sampler that tolerates weirdness the plain versions choke on.

Why this one is worth trying

The README's claim is that you can get away with more extreme noise types here and still land on something reasonable - it specifically calls out green_test noise as usable with this sampler. That's not nothing: green noise is aggressively anti-correlated (it's the kind of noise that emphasizes high-frequency detail), and most samplers fall apart when you feed it weird initial noise. DPM++ SDE plus momentum apparently shrugs it off.

Inputs are the same momentum core as the Euler versions (momentum 0.95, momentum_hist 0.75, momentum_init, direction, rand_init_noise_type) with the SDE knobs on top: s_noise (noise multiplier for the stochastic part), eta (ancestralness; 0 = non-ancestral), and noise_type (default brownian here rather than gaussian - a hint at the intended character). There's an optional guidance_cfg_opt socket for extended guidance and a custom_noise_opt for a custom noise chain, which overrides noise_type when connected.

The one real issue

Stochastic samplers at the tail end of generation can leave output looking washed out and blurry. The author's suggested fix is the BlehDiscardPenultimateSigma node from his other pack, ComfyUI-bleh, which drops the penultimate sigma step that tends to produce the muddy finish. You don't need bleh for the sampler itself, but you'll want it if you hit the blur.

Installing and wiring

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

or via ComfyUI Manager ("ComfyUI-sonar"), then restart. No model downloads. Output is a SAMPLER socket for the custom sampling pipeline (SamplerCustomAdvanced + BasicScheduler, or CFGGuiderSamplerCustom). ComfyUI-bleh is a separate pack if you want the extra blend modes and the sigma-fix node.

Two pack-wide caveats to file away: the author changes inputs fairly often, so pin your git revision if you care about reproducible generations, and seeds aren't portable between GPUs since some noise runs on CPU. For the SDE variant specifically, don't trust it to be a drop-in upgrade over stock DPM++ SDE - A/B it on a couple of seeds before committing a whole workflow to it. When it works it's a genuinely different look; when it doesn't, it's mushy in a way the plain version never is.

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_typeCOMBObrownianSets the type of noise.
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