ZML_路径加载LoRA
Load LoRAs from any folder, by index, on a schedule
- 模型
- CLIP
- 模型
- CLIP
- 当前lora
- 全部lora
ComfyUI's normal LoRA loader only sees LoRAs sitting in the models/loras folder, and you pick one from a dropdown. ZmlLoraListOutput (ZML_路径加载LoRA) does something else entirely: it reads LoRAs from any folder path you give it, and loads whichever one an integer index points at. That one sentence is the whole point - it turns "pick a LoRA" into "load LoRA number N," which is the lever you need for scheduled, random, or looped LoRA chains.
The inputs:
文件夹路径(folder path) - the directory holding.safetensors/.pt/.bin/.ckptfiles. The node scans it and sorts the list.lora数量(how many of the folder's LoRAs to consider, from the top of the sorted list).索引(index) - which of those gets loaded into the model this run. This is the input you drive with an integer node.权重(strength) - applied to the selected LoRA.
Outputs: 模型 and CLIP (the model and CLIP with the selected LoRA applied, fed through from your optional 模型/CLIP inputs), 当前lora (a string like filename : 1.0 for the one currently loaded, or 加载失败: ... if it blew up), and 全部lora (a newline-joined list of every LoRA in the folder with the weight, ready to paste or parse).
The README explains the intended trick directly: combine this with integer nodes and you can load LoRAs in sequence or randomly. Random integer → random LoRA per run; a counter or a fixed seed-driven integer → a deterministic sequence. That's a genuinely different workflow from the manual picker - think "shuffle through my style LoRAs and show me a batch," or "one generation per LoRA to compare them."
A couple of honest caveats, and they come straight from the code. If 模型 is left unwired, the node creates an empty placeholder dict and "loads" the LoRA into it - which won't produce a usable model, so always wire real model and CLIP in. The node deepcopys your model before applying the LoRA, which is safe but costs a little memory and time per run. And lora数量 truncates the sorted list, so "first N" means "alphabetically first N," not "the N you care about" - sort your filenames accordingly if you're driving it with an index.
Mechanically it's the standard comfy.sd.load_lora_for_models(model, clip, lora, strength, strength) call - the same one every LoRA loader uses - so the LoRA application itself is rock solid. What's unusual is the list plumbing around it.
Install the pack once:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
or via Manager, then restart. It's under ZML 图像 → lora加载器. If you mostly apply the same two LoRAs by hand, skip this and use the ZML five-slot loader instead - this node shines when the index is driven by something else, not when you're typing it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| 文件夹路径 | STRING | — | |
| lora数量 | INT | 11–100 | — |
| 权重 | FLOAT | 1.00-10–10 | — |
| 索引 | INT | 00–100 | — |
| 模型opt | MODEL | — | |
| CLIPopt | CLIP | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| 模型 | MODEL | — |
| CLIP | CLIP | — |
| 当前lora | STRING | — |
| 全部lora | STRING | — |