Nodes/ComfyUI-RyuuNoodles/Check Text Encoder Diff 🐲
ComfyUI Node

Check Text Encoder Diff 🐲

A diagnostic that tells you whether your text encoder diff is worth saving

By DraconicDragonΒ·Created about a year agoΒ·Updated 2 months agoΒ· 12
Check Text Encoder Diff 🐲
  • text_encoder_diff
  • text_encoder_diff
  • any_diff_zero
  • text_projection_diff_zero

When you merge two checkpoints and subtract the base, you get a CLIPSubtract output - the "diff" of the text encoders. The question nobody answers for you: is that diff actually real, or is it full of zeroed-out weights that would bloat a saved LoRA with nothing? This node exists to answer that question before you spend a minute extracting. It inspects the diff, reports whether any weight is exactly zero, and hands the diff back unchanged so you can keep going.

What it does

Feed it a text_encoder_diff (any CLIPSubtract output, per the author's tooltip) and it walks every .weight tensor in the diff, checking whether the absolute sum is zero. Two booleans come out:

  • any_diff_zero - true if any weight tensor in the text encoder diff is exactly zero.
  • text_projection_diff_zero - true if the specific *.transformer.text_projection.weight key is zero. That's the projection SDXL/SD3-style text encoders use, and it's a common spot for a zeroed or meaningless diff.

The node also returns text_encoder_diff itself, unchanged, so you can chain it: wire the diff in, read the booleans, pass the same diff onward to an extractor.

Why should you care? When a diff is zero on some weights, the text encoder contributes nothing there - and extracting it anyway bakes junk into your LoRA file. This node is the natural partner to the pack's Extract and Save Lora node, which has skip_on_any_diff_zero and skip_on_proj_diff_zero options that literally mirror these two checks. Wire this node's booleans into a switch, and you can conditionally skip the TE extraction entirely when there's nothing to save. It's a diagnostic you run once to learn your merge is clean - and then keep around as a guard.

It also logs its findings to the console (which weights came up zero, and the two booleans), so even without reading the sockets you'll see the verdict in your terminal.

Inputs and output

  • text_encoder_diff - the CLIP diff to inspect. Required.
  • Outputs: text_encoder_diff (passthrough), any_diff_zero, text_projection_diff_zero - both BOOLEAN.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/DraconicDragon/ComfyUI-RyuuNoodles

Restart ComfyUI, or install via Manager (search "RyuuNoodles"). No models, no extra dependencies.

Gotchas

It checks for exactly zero differences. A tiny-but-nonzero diff (say 1e-9) reports as "not zero," which is technically correct and practically noise - if your extract is coming out bloated, don't rely on this alone; compare file sizes after extraction. And it's flagged experimental in the code, matching the author's own note that the TE-extraction side of this whole workflow has produced mixed results. Use the booleans as guidance, sanity-check the output LoRA once, and you'll be fine.

CategoryRyuuNoodles 🐲/Utils

Inputs (1)

NameTypeDefaultDescription
text_encoder_diffCLIPThe e.g.: CLIPSubtract output to check

Outputs (3)

NameTypeDescription
text_encoder_diffCLIPβ€”
any_diff_zeroBOOLEANβ€”
text_projection_diff_zeroBOOLEANβ€”