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

+8
View File
@@ -378,8 +378,16 @@ typedef struct RadGenBatch {
/* COND: the pass's token ids on the host ([n_tok]), for a plugin whose issue depends on
* where a window's end-of-text marker sits. */
const int32_t* tokens_h;
/* ---- appended in ABI 26 (Krea 2's rebalance) */
/* COND: the request's RAD_GEN_COND_* options, 0 for none. */
int32_t cond_opts;
} RadGenBatch;
/* A request's conditioning options on a COND pass (RadGenBatch::cond_opts). */
enum {
RAD_GEN_COND_REBALANCE = 1 /* Krea 2: the text taps at the plugin's fixed rebalance gains */
};
/* An entry's flags on a DENOISE pass. */
enum {
RAD_GEN_F_FIRST = 1, /* the image's first step: its latent is the noise its seed draws */