Nodes/Kandinsky 2.2 ComfyUI Plugin/Kandinsky2.2 Prior 2-Averaging
ComfyUI Node

Kandinsky2.2 Prior 2-Averaging

Prior 2-Averaging

By vsevolod-oparin·Created 3 years ago·Updated about a year ago· 9
Kandinsky2.2 Prior 2-Averaging
  • in1
  • in2
  • PRIOR_LATENT
w10.50
w20.50

Of the pack's three averaging nodes, this is the one that actually gets used. Every shipped workflow - image-embed, img2img, and depth - routes its conditioning through a Prior 2-Averaging. The other two exist for completeness; this one is the workhorse.

Kandinsky 2.2's superpower is that image embeddings and text embeddings live in the same space. This node exploits that: it takes two PRIOR_LATENTs, multiplies each by a weight, and sums them. Feed one input the image_embeds from the Image Encoder (your reference photo) and the other the image_embeds from a text encoder (your prompt), and you get a blended embedding that carries both the structure of the image and the description of the text. It's a lightweight style/content mix that predates a lot of what people now call image-editing workflows.

Inputs and output

  • in1, w1 (default 0.5) and in2, w2 (default 0.5) - the two prior latents and their weights.

Output: one PRIOR_LATENT, into the Unet Decoder's image_embeds port.

A couple of practical notes on the weights. They don't have to sum to 1 - the node is a plain weighted sum, not a normalized average. Defaults are 0.5/0.5, and that's a sane start. If one side dominates, it's not "bad"; it just means the output is pulled harder toward that embedding.

Installing it

Same pack, manual install (README says it's not in ComfyUI Manager's list):

cd ComfyUI/custom_nodes
git clone https://github.com/vsevolod-oparin/comfyui-kandinsky22
cd comfyui-kandinsky22
python -s -m pip install -r requirements.txt

Models into ComfyUI/models/checkpoints:

git clone --depth 1 https://huggingface.co/kandinsky-community/kandinsky-2-2-prior
git clone --depth 1 https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder
git clone --depth 1 https://huggingface.co/kandinsky-community/kandinsky-2-2-controlnet-depth

Gotchas

  • Both inputs must be the same kind of thing. A text encoder's image_embeds and the Image Encoder's image_embeds mix fine; the averaging node doesn't care where they came from. What it doesn't accept is a bare LATENT or a conditioning - keep everything PRIOR_LATENT.
  • Dependency pin. Pinned old diffusers commit and accelerate==0.27.2 can collide with other custom nodes in the shared environment.
  • It's history. Kandinsky 2.2 stopped being community-relevant around mid-2024. This averaging trick is a genuinely interesting idea worth a weekend, but nobody is building production workflows on it anymore.

If you somehow need three or four blended embeddings, the 3- and 4-input siblings do exactly what their names say. This one covers 99% of real graphs.

Categoryconditioning

Inputs (4)

NameTypeDefaultDescription
in1PRIOR_LATENT
w1FLOAT0.500–100
in2PRIOR_LATENT
w2FLOAT0.500–100

Outputs (1)

NameTypeDescription
PRIOR_LATENTPRIOR_LATENT