Nodes/ComfyUI_UniversalSubspace/Apply Universal Weights
ComfyUI Node

Apply Universal Weights

Reconstruct a LoRA From a Few Hundred Coordinates

By a-ru2016·Created 8 months ago·Updated 8 months ago· 0
Apply Universal Weights
  • model
  • clip
  • subspace
  • universal_weights
  • MODEL
  • CLIP
strength_model1.00
strength_clip1.00

ApplyUniversalWeights is the payoff node of ComfyUI_UniversalSubspace. The loaders upstream just move files around - this is the one that takes a UNIVERSAL_SUBSPACE basis plus a tiny UNIVERSAL_WEIGHTS alpha file, rebuilds a real LoRA out of them, and applies it to your model and clip. If the pack's bet is right, this is how you'd use a LoRA that's been compressed down to a few hundred coordinate values.

How it works

The math per layer is simple, and it's the same reconstruction formula everywhere in this pack:

w_down = μ_down + V_down · α
w_up   = μ_up   + V_up   · α

So per layer it pulls the mean and basis for the down/up matrices from the subspace file, multiplies the basis by the alpha coordinates, and adds the mean back. Then comes the fiddly part the loader nodes skip: it maps the result onto your actual model. The code scans the live UNet and CLIP for every Linear / Conv2d (and LoRACompatible) layer to build a shape map, converts the pack's unet. / te1. / te2. / te. key prefixes into ComfyUI's lora_unet_ / lora_te1_ / ... format, reshapes the reconstructed weights to each layer's real shape, and finally hands the whole thing to ComfyUI's own load_lora_for_models. From there it behaves like any other LoRA application.

The inputs that matter

  • model and clip - your checkpoint's model and clip, exactly like a normal LoraLoader.
  • subspace - UNIVERSAL_SUBSPACE from UniversalLoRALoader. The shared basis.
  • universal_weights - UNIVERSAL_WEIGHTS from LoadUniversalWeights. The specific LoRA, as alpha coordinates.
  • strength_model and strength_clip - both default to 1.0 and range from -10 to 10. Same semantics as a normal LoRA weight: below 1 softens it, past 1 pushes it, negative inverts. Set both to 1.0 to start, like you would with any LoRA.

Outputs are MODEL and CLIP, wired into your sampler and conditioning just like the outputs of the stock LoraLoader.

Where it quietly fails

The big gotcha, which you'll hit before you hit anything else: if nothing reconstructs, the node returns your model unchanged. The code counts how many layers it managed to rebuild, prints Universal LoRA Applied Layers: N, and if that count is 0 it just returns the inputs. No error, no red node - you get an image that looks like the LoRA never applied.

The usual reasons the count is zero: the weights file's alpha key names don't match the basis file's layer names, or the alpha length doesn't match the basis rank, so the shape check fails and the layer is skipped. There's a fallback for _text_model_-style key differences, but it can't save you from feeding it mismatched artifacts. So the practical rule is: the basis file and the weights file have to have been produced for each other, and the debug console is your only honest feedback loop.

Install

Same as the rest of the pack - no extra dependencies at all, just ComfyUI's built-in torch and safetensors:

# ComfyUI Manager: Manager → Install Custom Nodes → search "UniversalSubspace" → Install → Restart

cd ComfyUI/custom_nodes
git clone https://github.com/a-ru2016/ComfyUI_UniversalSubspace

Then restart ComfyUI and the node shows up under the UniversalSubspace category. A fair warning, stated plainly: this is research-grade code with zero community footprint. If you don't already have the author's subspace artifacts, there's nothing to feed this node, and no substitute basis file floats around the internet either.

CategoryUniversalSubspace

Inputs (6)

NameTypeDefaultDescription
modelMODEL
clipCLIP
subspaceUNIVERSAL_SUBSPACE
universal_weightsUNIVERSAL_WEIGHTS
strength_modelFLOAT1.00-10–10
strength_clipFLOAT1.00-10–10

Outputs (2)

NameTypeDescription
MODELMODEL
CLIPCLIP