Iter_FloatSwitch
Sweep CFG and denoise across a queue run with Iter_FloatSwitch
- FLOAT
You know the CFG sweep. Set 3.5, queue, set 4.5, queue, set 5.5, queue, squint at the outputs. Iter_FloatSwitch is the ComfyUI-IterSwitch node that turns that ritual into one queue run: it's a float switcher that picks between several numeric inputs by index, so you can sweep a parameter instead of babysitting it.
What it does
Connect up to 128 FLOAT inputs (which in practice means a few Primitive/number nodes with typed values), pick one by output_index, and the node hands it downstream. Sweep CFG, denoise, strength, or any float parameter across a batch of queue items by driving the index from a counter. It's the same iterate-over-a-stack idea as the pack's other switches, just for plain numbers - and numbers are the thing you tune the most.
A detail that tells you this author has actually run ComfyUI: the switch logic checks is not None rather than Python truthiness, because in Python 0.0 is falsy. That means a genuinely wired 0.0 - like a denoise of zero, or a CFG of zero on a distilled model where it's the correct setting - is treated as a real value instead of being mistaken for "disconnected." It's a small thing, but it's exactly the kind of gotcha that turns into a confusing bug in a lesser node.
How it works
Three widgets - output_index, input_count, use_last_input - and dynamically generated float_0, float_1, … sockets. input_count drives the socket count through a web extension: raise it and sockets appear, lower it and the extras get trimmed without disturbing existing connections. Default use_last_input is on, so if your target slot is disconnected the node walks backward toward float_0 and returns the nearest connected value.
At run time it computes target = output_index % input_count - out-of-range indexes wrap instead of erroring - then applies the fallback logic above and returns a plain FLOAT.
Wiring it up
input_count- how manyfloat_Nsockets exist; set before wiring.output_index- which float passes through. Wire a counter here to sweep.use_last_input- defaults on; backward-fallback to the nearest connected lower slot.
The FLOAT output feeds any numeric input: a KSampler's cfg or denoise, an upscale node's strength, a blend node's mix factor. Classic pattern: three number primitives set to CFG 3.5 / 4.5 / 5.5 into the switch, switch output into KSampler's cfg, counter into output_index, one queue run, three outputs.
Installing the pack
ComfyUI-IterSwitch ships with no extra Python dependencies - there's no requirements.txt and nothing to download. Install is a clone:
cd ComfyUI/custom_nodes
git clone https://github.com/younger15/ComfyUI-IterSwitch.git
Restart ComfyUI afterward so the web extension loads. Prefer Manager? Search "ComfyUI-IterSwitch," and if it's absent from the registry, use install-by-Git-URL with the same repo link.
Common issues
Nonepasses through on an unconnected target. Withuse_last_inputon, the fallback only looks backward from your target - if all your connected values sit at higher indexes, you still getNoneand the sampler will complain. Keep a wired value at a low index.- Sockets missing after install. The dynamic inputs are JavaScript, so a backend-only restart won't create them. Restart ComfyUI fully or refresh the page.
- Silent wrap.
output_indexpast the count wraps via modulo. Great for loops; confusing when a counter runs long.
Honest framing: this pack has zero community footprint right now - none of these nodes appear in search-console data, so treat this as new territory rather than battle-tested. The code is short and readable if you want to verify the float handling; and if the fallback bites you, file it in the repo's issues.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| output_index | INT | 00–18446744073709550000 | — |
| input_count | INT | 21–128 | — |
| use_last_input | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |