LoRA Loader By Index (CCN)
LoRA Loader By Index (CCN)
- model
- clip
- model
- clip
- lora_name
- total_loras
- actual_index
- wrapped
LoRA Loader By Index (CCN) is the automation node for people who test LoRAs the way they should but rarely do: one at a time, same prompt, same seed, changing only the file. Instead of hand-selecting a LoRA from a dropdown for every run, you give it a folder and a number, and it loads the Nth LoRA in that folder - then tells you which one it loaded, how many there were, and whether the number wrapped around to the start. Feed that number from a counter node and you've built an unattended batch sweep.
How it works: you hand it a base model, an index, and a subdirectory under your LoRA folders. It scans that folder for LoRA files (.safetensors, .pt, .bin, .ckpt), sorts them alphabetically, and picks position index. Then it does exactly what the stock LoraLoader does under the hood - load_lora_for_models with your two strength values - so the patching is 100% standard. No surprises in the math; the innovation is the selection logic and the reporting around it.
Two behaviors matter. First, wrapping: if your index runs past the end of the list, it wraps modulo the count and sets the wrapped output to true, with a loud "LIST COMPLETE - WRAPPING TO START" message in the console when it hits zero again. That's your signal to stop a sweep loop. Second, it searches all configured LoRA paths, including extra_model_paths.yaml entries, and resolves the subdirectory across them - which is more forgiving than the List Directory node's primary-path-only scan. If you have one folder name split across multiple drives, it finds the first match.
The inputs you'll actually touch:
- index - which slot to load. Default 0, max 9999.
- strength_model / strength_clip - the standard LoRA strengths, -20 to 20. Pass a
clipin if you want the CLIP side patched; without one, only the model is patched.
Outputs, and they're generous on purpose:
- model, clip - the patched models, wire into your sampler.
- lora_name - the filename it actually loaded, so you can record it in your output.
- total_loras, actual_index - how many there were and which slot you landed in (post-wrap).
- wrapped - boolean, true if the index had to wrap. This is the one you build sweep-stop logic on.
Install
ComfyUI Manager → search "ComfyCollectorNodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes
Restart and find "LoRA Loader By Index (CCN)" under ComfyCollectorNodes → Loaders. No extra deps, no model downloads. MIT.
Common issues
The directory not found error is the usual stumble - the node searches every configured LoRA root, and if your subdirectory string matches nothing it raises and tells you exactly which paths it tried. Check the spelling: it's case-sensitive on Linux. And remember the index is alphabetical, not by date modified or by "recently added" - if you drop a new LoRA in mid-sweep, the alphabetical order shifts and your "same folder, next run" assumption breaks. That's what the wrapped output and the console messages are for: read them, because the node is designed to be the honest narrator of an automated run.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| subdirectory | STRING | — | |
| recursive | BOOLEAN | false | — |
| index | INT | 00–9999 | — |
| strength_model | FLOAT | 1.00-20–20 | — |
| strength_clip | FLOAT | 1.00-20–20 | — |
| clipopt | CLIP | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| clip | CLIP | — |
| lora_name | STRING | — |
| total_loras | INT | — |
| actual_index | INT | — |
| wrapped | BOOLEAN | — |