ComfyUI-LoRA-Merge-EXPERIMENTAL
Custom nodes for ComfyUI that support NP-LoRA and SSR-Merge based LoRA merging, providing loaders for subject-style LoRA fusion, calibration, and merged LoRA application. (Description by CC)
ComfyUI-LoRA-Merge-EXPERIMENTAL
Custom nodes for ComfyUI that support NP-LoRA and SSR-Merge based LoRA merging.
This extension currently provides:
- NP-LoRA Loader (Subject + Style)
- Fuses a subject/character LoRA with a style LoRA using NP-LoRA's asymmetric null-space projection.
- SSR-Merge Calibration
- Runs a lightweight calibration pass for SSR-Merge and builds a merged LoRA from internal activation statistics.
- SSR-Merge Loader
- Applies the result emitted by
SSR-Merge Calibrationto aMODEL.
- Applies the result emitted by
Internally, the extension uses ComfyUI's current custom-node API.
Installation
Place this directory under ComfyUI's custom_nodes directory. From the current development location:
Copy-Item -Recurse D:\tools\dev\ComfyUI-LoRA-Merge-EXPERIMENTAL D:\tools\ComfyUI\ComfyUI\custom_nodes\
Restart ComfyUI, then add the nodes from loaders/LoRA.
NP-LoRA Loader
The NP-LoRA loader follows Eq. 12 of the NP-LoRA paper. It attenuates the content LoRA component that overlaps with the right-singular-vector subspace of the style LoRA.
D_merged = D_style + D_content (I - mu/(1+mu) V V^T)
Basic usage:
- Set
content_lorato the subject, person, or character LoRA you want to preserve. - Set
style_lorato the style LoRA. - Start with
mu = 0.5. - Increase
muif the style is too weak. Decrease it if subject details are lost.mu = 0is equivalent to a direct additive merge.
SSR-Merge
SSR-Merge performs a short calibration inference before merging. It collects internal activation statistics, solves an analytic router, and absorbs that router into the up-projection so the result can be applied as a normal LoRA.
This extension exposes SSR-Merge as two nodes:
-
SSR-Merge Calibration
model/cliplora_1/lora_2prompt_1/prompt_2negative_prompt- seed, resolution,
lambda_reg - sampler / scheduler
-
SSR-Merge Loader
- Takes the
ssr mergeoutput fromSSR-Merge Calibrationand applies it toMODEL.
- Takes the
Calibration behavior
SSR-Merge Calibration runs a fresh calibration pass when the node is executed.
The calibration inference uses fixed lightweight values for steps and CFG:
- steps:
1 - cfg:
1.0
The sampler and scheduler are user-selectable in the node UI.
SSR-Merge logs normal progress at INFO level. The logs include:
- extracted LoRA layer counts
- routed and passthrough layer counts
- calibration start and end for each LoRA
- registered hook count
- activation statistics coverage
- router solve summary
- Loader timing
Current scope
- Model-side U-Net/DiT LoRA
- Linear and 1x1 convolution LoRA
- SSR merge for two LoRAs
CLIP-side LoRA, spatial LoCon kernels, DoRA, LoHa, and LoKr are intentionally excluded from SSR-Merge for safety.