ComfyUI Extension: ComfyUI-Lora-Sweeper

Authored by ethanfel

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Sweep a folder of LoRA training epochs: pick a step range + stride and sample one image per epoch from a single queue.

Looking for a different extension?

Custom Nodes (1)

README

ComfyUI-Lora-Sweeper

A single ComfyUI node, Lora Epoch Sweeper, that points at a folder of LoRA training epochs (e.g. an ai-toolkit / kohya output dir where files look like my_lora_000002000.safetensors), lets you pick a step range and a training-step interval, and applies each selected epoch to your model.

Because the node emits lists, ComfyUI runs everything downstream of it once per epoch — so a single click on Queue generates one image per LoRA epoch.

Install

Clone into ComfyUI/custom_nodes/ and restart ComfyUI:

git clone https://github.com/ethanfel/ComfyUI-Lora-Sweeper ComfyUI/custom_nodes/ComfyUI-Lora-Sweeper

No extra dependencies.

The node: Lora Epoch Sweeper

Category: loaders/LoraSweeper

Inputs

| Name | Type | Notes | |------|------|-------| | model | MODEL | Base model each epoch is applied to. | | clip | CLIP (optional) | Patched too if connected; otherwise model-only. | | folder_path | STRING | Absolute path to the epoch folder. ~ is expanded; a bare name is also looked up inside the loras dir. | | lora_basename | STRING | Which LoRA in the folder to sweep, when the folder holds several (substring of its name). Leave empty to auto-pick the LoRA with the most epochs. | | start_step | INT | Lowest training step to include (inclusive). | | end_step | INT | Highest step to include. 0 = no upper limit. | | step_interval | INT | Thin the range to ~one checkpoint per this many training steps (e.g. 500). 0 = keep every epoch. | | strength_model / strength_clip | FLOAT | LoRA strengths (same as the stock LoRA loader). | | include_base | BOOLEAN | Also include the final suffix-less name.safetensors. | | max_count | INT | Hard cap on number of epochs. 0 = unlimited. |

step_interval targets the multiples of the interval inside your range and snaps each to the nearest available checkpoint — so with epochs saved every 250 steps, step_interval = 500 gives the round 500, 1000, 1500, …. Odd intervals that don't divide your save schedule still return well-spaced checkpoints.

Folders with several LoRAs

One folder often contains epochs from more than one training run, e.g.:

styleA_000000250.safetensors ... styleA_000004000.safetensors   (16 epochs)
styleB_000006750.safetensors                                    (1)
styleC_000002500.safetensors                                    (1)

The node groups files by LoRA name (everything before the _<step> suffix) and only sweeps one group. Set lora_basename to pick it (e.g. styleA), or leave it empty to auto-select the group with the most epochs. An ambiguous substring raises an error listing the matches.

Outputs (all lists, one entry per epoch)

| Name | Type | Use | |------|------|-----| | model | MODEL | Wire to KSampler. | | clip | CLIP | Wire to your text encoders (or ignore). | | step_label | STRING | The step number, e.g. "2000" ("final" for the base file). | | lora_name | STRING | Filename without extension. |

Example

A LoRA with epochs saved every 250 steps from 250 to 4000:

  • start_step = 1000, end_step = 3000, step_interval = 500 → sweeps 1000, 1500, 2000, 2500, 3000.

Wire it up:

Sweeper.model  -> KSampler.model
Sweeper.clip   -> CLIPTextEncode.clip   (if you use clip)
KSampler -> VAEDecode -> SaveImage

Press Queue once → you get one image per selected epoch.

Labeling each image with its step

On the SaveImage node, right-click → Convert filename_prefix to input, then connect step_label (or lora_name) to it. Each saved file is then named after the epoch it used. (Any text/label node that accepts a STRING input works the same way, since the output is list-aware.)

Notes

  • Each epoch is a separate patched model held in memory for the run; sweeping a large number of epochs at once uses more RAM. Use step_interval / max_count to thin big sweeps.
  • Step parsing expects the kohya/ai-toolkit _<digits>.safetensors suffix. Files without a numeric suffix are treated as the "final" checkpoint.

License

MIT

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more