ComfyUI Node

LoRA Iterator

Test every LoRA in a folder without touching the graph

By OATH-Studio·Created 5 months ago·Updated 5 months ago· 1
LoRA Iterator
  • model
  • clip
  • model
  • clip
  • lora_name
  • current_index
  • total_loras
directory[All]
lora_name
strength_model1.00
strength_clip1.00
control_after_generateincrement

You've just grabbed eight LoRAs trained for the same checkpoint and you want to see which one actually does something for your prompt. The stock way is soul-destroying: swap the filename in a LoraLoader, run, swap, run, swap, run. LoRA Iterator from OATH-Studio's comfy-LoRA-iterator pack automates the swapping so you queue once and get one image per LoRA. It's a drop-in replacement for the normal LoraLoader with a built-in "advance after each run" mechanism - and it's genuinely tiny.

What it actually is

It's a loader node: MODEL and CLIP in, patched MODEL and CLIP out, exactly like ComfyUI's stock LoraLoader. The twist is that instead of pinning one LoRA forever, it steps through every LoRA in a folder (or subfolder) of your models/loras directory. Queue N runs with control_after_generate set to increment and each generation uses the next LoRA in the list, wrapping back to the start when it hits the end. That's the whole job, and it does it without any extra Python dependencies - the requirements.txt is a stub that just notes everything you need ships with stock ComfyUI.

The one mechanical detail worth understanding: the node keeps its current position in a little state dict keyed by ComfyUI's per-node unique_id, and it tells ComfyUI "I changed" on every run (its IS_CHANGED returns a random value whenever you're not in fixed mode). That's what forces the re-execution that lets it advance. It also means each node instance in your graph iterates independently - two LoRA Iterators wired to different directories don't interfere.

The inputs and outputs that matter

You set three things and leave the rest alone:

  • directory - a dropdown of [All] plus every immediate subfolder of models/loras. This is the killer feature: group LoRAs by the model family they were trained on (SDXL, Flux, whatever) and the dropdown only offers compatible ones. Note it's immediate subfolders only - one level deep, no nesting.
  • lora_name - the LoRA to start from. The iteration picks up from here, so set it to the first one you want if you care about ordering.
  • control_after_generate - fixed, increment, decrement, or randomize. fixed makes it behave like a stock LoraLoader; the other three are where the node earns its keep. increment starts at the current selection and steps forward each run.

strength_model and strength_clip are the usual sliders (default 1.0, range -10 to 10). The outputs are model and clip (wire straight into your KSampler), plus three that make this genuinely useful: lora_name (a STRING you can feed a filename/preview-text node so every saved image is tagged with which LoRA produced it), current_index (zero-based), and total_loras.

Install

Either grab it via ComfyUI Manager (search "LoRA Iterator" or "comfy-LoRA-iterator"), or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/OATH-Studio/comfy-LoRA-iterator.git
# restart ComfyUI

It shows up under loaders/lora → LoRA Iterator. No model downloads, no pip installs, nothing extra.

Where people get burned

  • It advances by default. control_after_generate defaults to increment, so if you hit Run twice wondering why the second image looks different - that's it working. If you only want one LoRA tested, set it to fixed. This catches everyone once.
  • The first run uses your selected lora_name, not the first in the folder. Iteration starts from wherever the dropdown points.
  • lora_name comes out as a relative path like zimage/AnimeMix.safetensors, not a bare filename - fine for filename nodes, just don't expect the raw name.
  • Empty directories are silent. No LoRAs found means the node passes the model through untouched and prints [LoRADirectoryIterator] No LoRAs found to the console. If nothing's changing and you're in increment mode, check the directory filter first.

Bottom line

For its size this is a remarkably complete little node: directory filtering, four advance modes, index outputs, per-instance state. If you batch-test LoRAs more than once a week, it'll pay for itself in graph edits within an afternoon.

Categoryloaders/lora

Inputs (7)

NameTypeDefaultDescription
modelMODEL
clipCLIP
directoryCOMBO[All]1 options: [All]
lora_nameCOMBO1 options: (no loras found)
strength_modelFLOAT1.00-10–10
strength_clipFLOAT1.00-10–10
control_after_generateCOMBOincrement4 options: fixed, increment, decrement, randomize

Outputs (5)

NameTypeDescription
modelMODEL
clipCLIP
lora_nameSTRING
current_indexINT
total_lorasINT