Queue Loop (TJ)
Batch your seeds and LoRAs with Queue Loop (TJ)
- index
- index_text
- queue_count
You know the loop. Change the seed, run. Change it again, run. Fifty more times because you're testing LoRAs and want to compare them all. Queue Loop (TJ) automates exactly that: it re-queues the whole workflow a set number of times, and hands you an index that changes every run so you can drive seeds, LoRA picks, or anything else through the iterations. It's the difference between babysitting ComfyUI and letting it churn while you go do something else.
How it works
The mechanism is a frontend/backend handshake. On each run the node outputs the current index and the number of times it should loop (queue_count); the frontend sees the loop wants to continue, increments its internal counters, and queues the next run automatically. It also returns float("nan") from its change-detection so ComfyUI never serves a cached result from a previous identical run - a detail that quietly prevents a whole class of "why is it not advancing" bugs.
The knobs:
queue_count- total iterations. Default 50, which is a lot; set it to how many variants you actually want.start_index/end_index/step- the range the index walks. Want every other seed from 1 to 10? start 1, end 10, step 2.index_loop_mode-Index Loopwraps back to the start when it hits the end (run forever over a range);Index Stop at Endhalts the queue when the range is exhausted.
Outputs: index (INT) - the current iteration, wire this into a seed widget or a LoRA loader's index; index_text (STRING), same value as text for filename prefixes and such; queue_count (INT), the total so downstream knows the plan. auto_set (default on) publishes them as wireless providers.
Using it with the pack's pieces
Queue Loop is the engine behind a couple of TJ workflow patterns. Pair its index with Index LoRA Loader (TJ) and it walks your LoRA folder one model per run, testing each automatically. Pair queue_count with the Index LoRA Loader Counter (TJ) and the loop count stays in sync with how many LoRAs you actually have - the counter reads the loader's widget values directly (no graph link) specifically to avoid the circular reference a direct connection would create. The pack also has an Images Compare Sheet - Queue Loop (TJ) that accumulates every loop iteration's output into one comparison sheet, which turns the whole thing into an automated A/B grid.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/designloves2/ComfyUI-TJ_NODE
or ComfyUI Manager → ComfyUI-TJ_NODE → restart. No dependencies beyond the pack.
Common issues
If your loop only runs once or repeats the same index, the usual culprits are a stale ComfyUI frontend (hard-refresh) or the loop node being inside a subgraph the frontend isn't watching. And a genuine warning from the maintainer: recent versions fixed the case where connected inputs were ignored when typing values directly - the node now reflects connected sources' current values immediately, so if you're feeding queue_count from a counter, trust the wire, not the number you typed.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| auto_set | BOOLEAN | true | — |
| queue_count | INT | 501–1000000 | — |
| current_index | INT | 11–1000000 | — |
| current_queue | INT | 00–1000000 | — |
| start_index | INT | 11–1000000 | — |
| end_index | INT | 41–1000000 | — |
| step | INT | 11–1000000 | — |
| index_loop_mode | COMBO | Index Loop | 2 options: Index Stop at End, Index Loop |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| index | INT | — |
| index_text | STRING | — |
| queue_count | INT | — |