krea2: rebalance, the text taps at ConditioningKrea2Rebalance's gains

A request may ask for Krea 2's twelve text taps to be multiplied by fixed gains
before the text fusion, as ComfyUI's ConditioningKrea2Rebalance (nova452) does at
its defaults: multiplier 4 times the per-layer weights 1, 1, 1, 1, 1, 1, 1, 2.5,
5, 1.1, 4, 1. `rebalance: true` on /v1/images/generations (JSON or form) sets
RAD_GEN_COND_REBALANCE in RadGenBatch::cond_opts, appended in ABI 26; the plugin
then scales each tapped layer's rows into te.h2 with chan_affine (f32, rounded
once) and scatters those instead of te.x, so the residual stream is untouched.
Without the field every pass issues exactly what it did before; other models
ignore it.

The gains cannot be folded into weights: the taps enter the fusion's layer-wise
blocks raw, through a pre-norm residual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-22 11:55:38 +02:00
1 parent 7aa51e5b4a
commit 123c439684
8 files changed
+76 -5

No files matched your search

+1
View File
@@ -379,6 +379,7 @@ ABI_FIELD(RadGenBatch, step)
ABI_FIELD(RadGenBatch, size_px)
ABI_FIELD(RadGenBatch, entry_h)
ABI_FIELD(RadGenBatch, tokens_h)
ABI_FIELD(RadGenBatch, cond_opts)
ABI_STRUCT(RadGeneratorDecl)
ABI_FIELD(RadGeneratorDecl, name)
ABI_FIELD(RadGeneratorDecl, layout)
+2 -1
View File
@@ -321,7 +321,7 @@
{ "RadFuseStep", "n_p", 584, 4 },
{ "RadFuseStep", "from", 588, 32 },
{ "RadFuseStep", "n_from", 620, 4 },
{ "RadGenBatch", "", 0, 400 },
{ "RadGenBatch", "", 0, 408 },
{ "RadGenBatch", "rows", 0, 8 },
{ "RadGenBatch", "src", 8, 8 },
{ "RadGenBatch", "rope", 16, 8 },
@@ -375,6 +375,7 @@
{ "RadGenBatch", "size_px", 376, 8 },
{ "RadGenBatch", "entry_h", 384, 8 },
{ "RadGenBatch", "tokens_h", 392, 8 },
{ "RadGenBatch", "cond_opts", 400, 4 },
{ "RadGeneratorDecl", "", 0, 376 },
{ "RadGeneratorDecl", "name", 0, 8 },
{ "RadGeneratorDecl", "layout", 8, 4 },