Batch Counter π’
A Counter That Survives Restarts β and Hands You a Fresh Seed Every Run
- count
- derived_seed
Every ComfyUI user eventually wants the same thing: hit "Queue" ten times, get ten different images without touching anything. The built-in way is the seed widget's control_after_generate = randomize, but that's a random roll every run - you can't predict or reproduce the sequence, and if you're farming variations you often want a pattern, not chaos. Batch Counter is the deterministic answer: a counter that increments once per queued run and derives a seed from its count, so run N always uses the seed you expect.
The mechanism is the part that makes it trustworthy. Most counter nodes keep their state in memory, which means they reset every time ComfyUI restarts - or worse, when another node unloads models and the garbage collector clears them. This one writes a tiny counter file into ComfyUI's output/ folder and reads it back on every execution. The count survives restarts, crashes, and midnight ComfyUI updates. That file persistence is the whole selling point.
The inputs that matter
counter_id- names the counter file (<id>.counterunderoutput/), so you can run several independent counters side by side, one per workflow. Change it and the count starts fresh.step- how much the counter advances each run (default 1).reset- zeroes the counter on this execution. Nice touch: a reset run still counts, ending atsteprather than 0, so you never get handed a useless zero seed.base_seedandseed_step- these are how you get the actual seed.derived_seed = base_seed + count * seed_step. Keepseed_stepat 1 for consecutive seeds, or bump it to skip around.
The two outputs are count and derived_seed. Wire derived_seed into any seed input (or a KSampler's seed socket) and the graph gives you a new, reproducible seed on every queue run - no manual incrementing, and you can predict exactly what seed run #7 used by doing the arithmetic in your head.
Pairing it
The README's own suggestion is the good one: pair it with OmniNodes' Prompt List Iterator, which reads prompts from a file and returns the Nth one. Feed the counter's count into the iterator's index and each queue run steps through a prompt list and rolls a fresh seed - a poor man's batch queue without any extra infrastructure.
Install
In ComfyUI Manager search for OmniNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes
Restart ComfyUI, find it under TensorVizion/Workflow. No extra dependencies.
Gotchas
This node forces itself to run every execution (it returns NaN from IS_CHANGED, the standard "always re-run" trick), so it will never be skipped by ComfyUI's caching. That's correct behavior - but if you're chasing a mysterious slowdown, know that any node wired behind a counter like this also re-runs every time, because its input changed. And if you want the same seed twice, remember the counter doesn't care: it increments unconditionally, so use a fixed seed or reset instead of expecting it to hold still.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| counter_id | STRING | default | β |
| step | INT | 11β100000 | β |
| reset | BOOLEAN | false | β |
| base_seed | INT | 00β18446744073709550000 | β |
| seed_step | INT | 10β1000000 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| count | INT | β |
| derived_seed | INT | β |