Nodes/ComfyUI-YCNodes/LoRA Selector (YC)
ComfyUI Node

LoRA Selector (YC)

A ten-slot LoRA switcher you can chain — and it only loads the LoRA you picked

By yichengup·Created 2 years ago·Updated 4 months ago· 48
LoRA Selector (YC)
  • cascade_input
  • input0
  • input1
  • input2
  • input3
  • input4
  • input5
  • input6
  • input7
  • input8
  • input9
  • selected_lora
mode选择LoRA
index0

Ten input ports, one index, one output - a LoRA switcher with a party trick: thanks to lazy evaluation it only actually loads the LoRA you select. Wire ten LoRA loaders into its ports, flip the index, and the graph runs only the one you asked for. And when ten isn't enough, its cascade mode lets you chain selectors to manage as many LoRAs as you have disk for.

What it's actually for

Swapping LoRAs without rebuilding the graph. The loop-workflow classic: you're iterating over characters or styles, and each iteration needs a different LoRA. Instead of ten copies of a LoRA loader wired to ten samplers, you wire ten loaders into one selector and drive it with an index - from an XY plot, a batch loop, or a manual widget. The lazy bit is the real win: in a "normal" switch, ComfyUI still evaluates every branch it can, loading every LoRA into VRAM even the ones you skip. This node's check_lazy_status tells ComfyUI only to run the branch you selected, so unselected LoRA loaders never execute.

How it works

Two modes, and the Chinese labels on the widget are worth knowing:

  • 选择LoRA ("Select LoRA") - the default. index (0–9) picks which of input0input9 passes through.
  • 使用级联 ("Use cascade") - ignores the ports and passes cascade_input straight through.

The cascade mode is the chaining mechanism: connect selector A's output into selector B's cascade_input, set A to "Select LoRA" and B to "Use cascade", and you've got twenty slots. Keep stacking and you can route arbitrarily many LoRAs through a single downstream connection. IS_CHANGED returns NaN, which forces re-evaluation every run so index changes always take effect.

Inputs and outputs

  • mode - "Select LoRA" (by index) or "Use cascade" (pass-through)
  • index - 0–9, which port to select
  • input0–input9 - the ten LoRA ports (each accepts any type; in practice, a LoRA-stack or model output)
  • cascade_input - the chain input

Output is selected_lora, a wildcard type you wire into whatever consumes your LoRA - typically a LoRA loader's lora port or a stack builder.

Install

Ships in ComfyUI-YCNodes. ComfyUI Manager → search "ComfyUI-YCNodes" → install, restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes

Deps are the pack standard - torch, numpy, pillow, opencv-python, scipy - with no model downloads.

Where people get burned

  • The Chinese labels. If you don't read Chinese, the two mode options look like mojibake until you recognize the pattern. "选择LoRA" is select-by-index; "使用级联" is cascade pass-through.
  • An empty port returns None, not an error. Pick an index with nothing connected and you get a silent None output - which then poisons whatever consumes it. Check your wiring before you blame the sampler.
  • Lazy evaluation needs a compatible ComfyUI. The lazy-loading trick relies on modern ComfyUI's advanced model execution; on older builds it still works as a plain switch, just without the "only load what you pick" benefit.

Compared to heavyweight context/selector packs, this is a lean, no-dependency way to get the same "pick a LoRA per iteration" behavior - and the cascade trick is genuinely handy when you outgrow ten slots.

CategoryYCNode/LoRA

Inputs (13)

NameTypeDefaultDescription
modeCOMBO选择LoRA选择模式:选择LoRA使用index选择输入端口,使用级联则从级联输入获取LoRA
indexINT00–9在'选择LoRA'模式下,选择0-9号LoRA
cascade_inputopt*级联输入,通常连接到上一个选择器的输出
input0opt*LoRA输入 #1
input1opt*LoRA输入 #2
input2opt*LoRA输入 #3
input3opt*LoRA输入 #4
input4opt*LoRA输入 #5
input5opt*LoRA输入 #6
input6opt*LoRA输入 #7
input7opt*LoRA输入 #8
input8opt*LoRA输入 #9
input9opt*LoRA输入 #10

Outputs (1)

NameTypeDescription
selected_lora*