Custom node for ComfyUI that loads a LoRA like the core LoraLoaderModelOnly, but adds a filename range sweep workflow for testing many LoRA checkpoints from the same training run.
- Adds the node Load LoRA Range (Model Only).
- Loads the LoRA selected in
currentexactly like the core model-only LoRA loader. - Adds
firstandlastfields to define an allowed filename range. - Adds
modeto control howcurrentchanges after each queued run. - Supports these modes:
fixed: keepcurrentunchangedincrement: move to the next filename in the sortedfirst..lastrange and wrap tofirstdecrement: move backward in the sortedfirst..lastrange and wrap tolastrandom: pick a random filename from the sortedfirst..lastrange
The node is split into two parts:
- Backend Python loads only the LoRA selected in
current. - Frontend JavaScript updates
currentafter the workflow is queued.
This means the LoRA used for the current execution is always the value visible in current at queue time, and the next value is prepared for the following run.
- The list of LoRAs is sorted by filename in ascending order.
firstmust come before or equal tolastin that sorted list.- If
firstcomes afterlast, automatic switching is disabled. - If
currentis outside thefirst..lastrange, the node still loads that LoRA, butincrement,decrement, andrandomdo not change it.
- The node reuses the core
LoraLoaderimplementation. - It does not load
firstorlastinto memory. - It only loads
current. - It inherits the same single-entry cache as the core loader, so repeating the same
currentvalue does not reload the LoRA file unnecessarily.
Backend compatibility:
- The Python node is lightweight and relies only on ComfyUI core APIs.
- No extra Python packages are required.
Frontend compatibility:
- Full automatic switching of
currentrequires a modern ComfyUI frontend that supports widget queue lifecycle hooks. - If the frontend extension does not run, the backend node still works as a manual
currentLoRA loader.
- Add Load LoRA Range (Model Only) to the graph.
- Connect your
MODELinput. - Choose
first,last, andcurrentfrom the LoRA dropdowns. - Choose
mode. - Run the workflow repeatedly.
- Observe
currentadvancing for the next run according tomode.
- Open Manager in ComfyUI.
- Install this node from the list or by repository URL.
- Restart ComfyUI or refresh node definitions.
- Clone or copy this repository into
ComfyUI/custom_nodes/. - Restart ComfyUI.
No additional Python dependencies are needed.
__init__.py- backend node definition- web/lora_range_loader.js - frontend logic that advances
current
- The Registry package name in
pyproject.tomlis intended to be stable and should be treated as immutable after publishing. - If you want a different final GitHub repository URL or package name, change it before the first Registry publish.