Nodes/ComfyUI-ZML-Image/ZML_路径加载LoRA
ComfyUI Node

ZML_路径加载LoRA

Load LoRAs from any folder, by index, on a schedule

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_路径加载LoRA
  • 模型
  • CLIP
  • 模型
  • CLIP
  • 当前lora
  • 全部lora
文件夹路径
lora数量1
权重1.00
索引0

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/.ckpt files. 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.

Categoryimage/ZML_图像/lora加载器

Inputs (6)

NameTypeDefaultDescription
文件夹路径STRING
lora数量INT11–100
权重FLOAT1.00-10–10
索引INT00–100
模型optMODEL
CLIPoptCLIP

Outputs (4)

NameTypeDescription
模型MODEL
CLIPCLIP
当前loraSTRING
全部loraSTRING