LoRA Block Weight Editor
Draw Your LoRA Strength Curve Before You Load It
- weights
- visualization
If you've ever wished a LoRA could be strong where it helps and quiet where it fights the checkpoint, this is the node that writes those weights for you. The LoRA Block Weight Editor doesn't load anything - it's a calculator that generates a comma-separated list of per-block weights, plus a little ASCII chart so you can see what you just made. You feed that string to its sibling, the LoRA Block Weight Loader, which is the node that actually applies it.
Why bother? A LoRA never hits a model evenly. On Flux, blocks near the start of the transformer tend to steer composition and layout; later blocks are more about texture and fine detail. The old Auto1111 world had the sd-webui-lora-block-weight extension with its :IN / :MID / :OUT suffixes for exactly this reason. This editor is that idea with the training wheels off - you're setting a real number per block instead of picking one of three buckets.
How it works
Pick a pattern and the node does math across total_blocks (default 57, which is Flux's 19 double blocks + 38 single blocks - that default is not an accident). The amplitude, offset, frequency, and phase knobs shape whatever wave you chose. offset is the base value (keep it near 1.0 - that's "no change"), amplitude is how far above and below that base the curve swings.
The genuinely fun one is custom_expression. It's a small math string evaluated safely with i (current block) and n (total blocks) available, and it knows sin, cos, exp, log, sqrt, pi, and e. The default gives you the idea:
1.0 + 0.5 * sin(2 * pi * i / n)
That's a gentle wave across all 57 blocks. Want a sharp decay? 2.0 * exp(-i / (n / 3)). Want the first half hot and the second half quiet? 1.5 if i < n/2 else 0.5. You can prototype curves here in seconds that would take a dozen edits of a raw text field to get right blind.
The inputs that matter
- total_blocks - must match your model. Flux is 57. If you set it wrong the loader doesn't error, it pads or truncates your list, and you'll wonder why your curve doesn't match the picture.
- pattern - the shape:
uniform,linear_increase,linear_decrease,sine_wave,cosine_wave,sawtooth,step_function,random, orcustom_expression. - offset - your base strength; the thing you set first.
- custom_expression - the escape hatch when no preset pattern is quite right.
The two outputs are both plain strings: weights (the comma-separated list) and visualization (the ASCII bar chart with min/max/mean/std). Wire weights into the loader's block_weights input, and pipe visualization into any text-display node if you want to see the chart on your graph.
Installing it
It ships in the same pack as the loader, so one install gets you both:
cd ComfyUI/custom_nodes
git clone https://github.com/bhvbhushan/ComfyUI-LoRABlockWeight
# restart ComfyUI
Or open ComfyUI Manager, search "LoRA Block Weight", and hit install. Good news: the pack's actual dependencies are just torch and numpy - nothing exotic, no model downloads, no Nunchaku library required despite the loader's name. Restart and you're done.
Gotchas
Weights are clamped to 0.0–2.0 on output, so a wild expression won't blow up your render, just quietly saturate. The random pattern seeds itself from phase, so bump the phase to reshuffle rather than getting stuck with one "random" curve. And honestly - start by setting offset and one simple pattern before reaching for the expression parser. It's a tool for the 20% of the time you need a real curve, not the 80% where 1.0 everywhere is fine.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| total_blocks | INT | 571–200 | — |
| pattern | COMBO | 9 options: uniform, linear_increase, linear_decrease, sine_wave, cosine_wave, sawtooth, +3 | |
| amplitude | FLOAT | 1.000–2 | — |
| offset | FLOAT | 1.00-2–2 | — |
| frequency | FLOAT | 1.00.1–10 | — |
| phase | FLOAT | 0.00-3.14159–3.14159 | — |
| custom_expressionopt | STRING | 1.0 + 0.5 * sin(2 * pi * i / n) | — |
| visualizeopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| weights | STRING | — |
| visualization | STRING | — |