ComfyUI Node Runs on cloud

Number Counter

The stateful counter that remembers between runs

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Number Counter

      Most nodes in ComfyUI are stateless - they take inputs, produce outputs, forget everything. Number Counter is the odd one out, and that's the entire reason to use it. It remembers. Every time you queue a prompt, it ticks its internal number up (or down) by a step and hands you the new value. Queue again, it ticks again. That persistence between runs is the feature, and it's also the thing that trips people up.

      Why you'd reach for it

      Anywhere you want a value that changes automatically across a batch of runs. Naming saved files frame_001, frame_002, frame_003 without touching anything. Stepping through an index to pull a different line from a text file or a different image from a folder each run. Sweeping a CFG or denoise value across a range to compare results. You set it going and each queued prompt advances the counter on its own - no manual editing between runs.

      How it works

      It keeps a running number and mutates it each execution. The settings you care about:

      • mode - increment or decrement, plus "to stop" variants that count up (or down) until they hit a limit and then hold there. That's how you sweep a fixed range instead of counting to infinity.
      • start / stop / step - where it begins, where it stops (for the "to stop" modes), and how far it moves each run.
      • number_type - integer or float, depending on whether you're indexing (int) or sweeping a continuous value like denoise (float).

      There's a reset control so you can zero it back to the start when you begin a new batch. The output is the current number, which you wire into whatever consumes it - a seed input, a text-line index, a filename token, a math node.

      The gotcha nobody warns you about

      Because the state lives in the node, it survives across your whole session. Run your workflow ten times testing something, and the counter is now sitting at ten - so the "batch of 50" you kick off actually runs 10 through 60. If your outputs start at a weird offset, this is why. Reset it before a real run. The state can also drift if you're duplicating the node or reloading the graph, so treat the displayed value as the source of truth and reset when in doubt. It's not a bug - it's a stateful node behaving statefully in a mostly-stateless system, which is genuinely useful once the mental model clicks.

      Installing it

      Number Counter comes with WAS Node Suite. Grab the pack through ComfyUI Manager (search was-node-suite-comfyui, install, restart), or clone it by hand:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install its requirements.txt, restart. No models, no heavy dependencies for this one - it's pure logic.

      If the pack won't load

      WAS Node Suite went maintenance-only in late 2023, and the most common gripe is the whole suite failing to import after you update ComfyUI. It's almost always a package-version clash (WAS holds some older pins, opencv especially), and the fix is reinstalling the requirements into the right venv - activate it, or use the pack's install.bat. Once it imports, individual nodes like this one are rock solid.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs