Nodes/KJNodes for ComfyUI/Flip Sigmas Adjusted
ComfyUI Node Runs on cloud

Flip Sigmas Adjusted

Reverse a sigma schedule for unsampling

By kijai·Created 3 years ago·Updated a day ago· 3,011
Flip Sigmas Adjusted
  • sigmas
  • SIGMAS
  • sigmas_string
divide_by_last_sigmafalse
divide_by1.00
offset_by1

This one's for the custom-sampling crowd, so let's be upfront: if you don't already know what "unsampling" is, you probably don't need FlipSigmasAdjusted, and that's fine. For everyone else - it takes a sigma schedule and flips it, so noise runs low-to-high instead of high-to-low, with a few normalization knobs on top. Reversing the schedule is the core trick behind unsampling, where you push an existing image back up into noise in a structured way so you can then resample it, which is how a lot of style-transfer and video-to-video and detail workflows get their consistency.

It lives in KJNodes' noise category. Kijai's pack has a scattering of these advanced sampling utilities - small, sharp tools for people building SamplerCustom graphs by hand rather than using a one-click KSampler.

How it works

Sigmas are the per-step noise levels a sampler walks down: it starts at a high sigma (lots of noise) and steps toward zero (clean image). Flip that array and you get the reverse walk - from clean toward noisy - which is what an unsampling pass consumes to re-inject structured noise. The "Adjusted" part is what separates this from a plain flip: it can normalize and shift the flipped schedule so it plays nicely with whatever sampler you feed it into.

The inputs and outputs that matter

  • sigmas (SIGMAS) - the schedule to flip, wired in from a scheduler node (BasicScheduler, an AlignYourSteps node, whatever you're using).
  • divide_by_last_sigma (BOOLEAN, default false) - normalize the whole array by its final value. On when you want the schedule scaled into a predictable range.
  • divide_by (FLOAT, default 1, min 1) - a straight scale factor on the sigmas. Leave at 1 unless you're deliberately compressing the range.
  • offset_by (INT, default 1) - shifts the array by a number of steps, handy for lining the flipped schedule up with what the sampler expects at the boundaries.

Two outputs: SIGMAS (the adjusted, flipped schedule - wire it into your custom sampler) and sigmas_string, a text dump of the resulting values so you can actually read what you built. That string output is more useful than it sounds when you're debugging a schedule that's misbehaving.

How to install it

ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

then restart (portable: pip via python_embeded\python.exe). Pure schedule math, nothing to download.

Common issues & troubleshooting

The sampler errored or produced mush. A flipped schedule isn't a drop-in replacement for a normal one - it only makes sense inside an unsampling setup (a custom sampler doing the noise-adding pass, then a second pass that resamples). Dropping it into a plain KSampler expecting a descending schedule won't do what you want.

divide_by won't go below 1. That's the schema minimum, not a bug. If you need to expand the range rather than compress it, this isn't the parameter for that.

The endpoints are off by a step. That's what offset_by is for. Small misalignments at the start or end of the flipped array usually clear up by adjusting the offset; check the sigmas_string output before and after to see what actually changed.

You're not sure this is doing anything. Read the sigmas_string. It's the whole point of that output - if the numbers aren't reversed and scaled the way you expected, the problem is upstream in how you generated the sigmas, not here.

CategoryKJNodes/noise

Inputs (4)

NameTypeDefaultDescription
sigmasSIGMAS
divide_by_last_sigmaBOOLEANfalse
divide_byFLOAT1.001–255
offset_byINT1-100–100

Outputs (2)

NameTypeDescription
SIGMASSIGMAS
sigmas_stringSTRING