ComfyUI Node

OptionalSwitchLoRA

One LoRA loader that can also be a wire-through

By vsaan212·Created 10 months ago·Updated 9 days ago· 1
OptionalSwitchLoRA
  • model
  • clip
  • MODEL
  • CLIP
command_or_path
strength_model1.00
strength_clip1.00

OptionalSwitchLoRA is a regular LoRA loader with one extra rule: if the LoRA path you give it is the word bypass (or empty), it does nothing and passes the model/CLIP straight through. That one rule turns a static loader into something you can drive dynamically, and it's the single most underrated node in this pack.

How it works

Wire model and clip in from your checkpoint loader or a previous LoRA. Set command_or_path to either:

  • bypass (case-insensitive) or an empty string → no LoRA applied, inputs pass through unchanged.
  • A file path → if the file exists, its directory is registered on the fly and the LoRA loads from it.
  • A name ComfyUI can already resolve from its models/loras folder.

strength_model and strength_clip (defaults 1.0, range 0–2) behave exactly like the stock LoraLoader's. Under the hood it's not reinventing anything - it delegates to ComfyUI's own LoraLoader for the actual apply. The only custom logic is the bypass check and the path registration.

Outputs are MODEL and CLIP, ready to feed your next node or your sampler.

Why you'd actually use it

The boring pattern is fine - a switchable LoRA in a fixed spot of a graph. But it shines when command_or_path is itself wired from another node: a Primitive string, a switch, or a file-based workflow that emits either a path or the word bypass. One node, two states, no rewiring. That's exactly how the pack's own Lazy-subject-and-scene-automation node implements its bypassable LoRA slots - this is the standalone, single-slot version of that idea.

Two of the genuinely useful setups:

  1. Stack several in series as optional style/character layers. Each can be live-toggled by feeding it bypass from upstream logic.
  2. Replace a conditional chain - instead of a switch node feeding a loader, just feed the OptionalSwitchLoRA whichever value you want active.

The dual-stack catch

This node patches one CLIP at a time. If you're on a Wan-style high/low dual-CLIP graph and want the same LoRA on both branches, you need two instances (same path and strengths) - or just use Lazy-subject-and-scene-automation, which applies whole stacks to clip_high and clip_low separately and is built for that job. For a single-CLIP SDXL/Flux-style graph, one instance is all you need.

Install

Standard for this pack: ComfyUI Manager → search vsaan212/Vsaan212-workflow-utilities, or clone into custom_nodes and restart. It's in the vsaan212/LoRA menu. Zero extra dependencies and no model downloads - it leans on ComfyUI's stock loader, so if your normal LoraLoader can see a LoRA, this node can too.

One gotcha from reading the code: the bypass check strips quotes and whitespace, so "bypass" works, but a typo like bypas is treated as a LoRA name and errors. When in doubt, empty string is always a safe bypass.

Categoryvsaan212/LoRA

Inputs (5)

NameTypeDefaultDescription
modelMODEL
clipCLIP
command_or_pathSTRING
strength_modelFLOAT1.000–2
strength_clipFLOAT1.000–2

Outputs (2)

NameTypeDescription
MODELMODEL
CLIPCLIP