Nodes/Rebels Krea2 Outpaint/Rebels Krea2 Outpaint Model Patch
ComfyUI Node

Rebels Krea2 Outpaint Model Patch

The attention surgery that makes registered outpainting actually work

By RealRebelAI·Created 2 months ago·Updated 2 months ago· 26
Rebels Krea2 Outpaint Model Patch
  • model
  • MODEL
placement
kv_cachetrue

Load Krea 2 Turbo, load the outpaint LoRA, and the model still doesn't know your source image is sitting in the canvas - it just sees noise and a prompt. This node is what fixes that. It reaches into Krea 2's SingleStreamDiT transformer and patches it so the reference latent gets registered into the target latent grid at the bounding box the Canvas node computed. Place it after Load LoRA and before the sampler, and it's the single node without which the other three in this pack do nothing.

It's a port of the reference-attention machinery from ostris's ComfyUI-Krea2-Ostris-Edit, with one surgical difference: instead of the reference tokens getting their own coordinate grid starting at (0,0), they're mapped into the target grid at the placement box, center-sampled - mirroring _pack_reference_latents in the original diffusers pipeline. That's the registration the LoRA was trained with, and it's the whole point of this pack.

What it actually does

Three inputs, one output:

  • model - your Krea 2 model with the outpaint LoRA already applied.
  • placement - the JSON string from the Rebels Krea2 Outpaint Canvas node. Same string you also feed the Composite node. Don't hardcode it; let the Canvas node feed both.
  • kv_cache (default true) - keep it on. The LoRA uses isolated reference attention, so the node precomputes the reference K/V once at t=0 and reuses it every step. Turning it off runs the reference through every block every step, which is slower and deviates from how the LoRA was trained.

The output is the patched MODEL, straight into your KSampler. Behind the scenes it hooks the model's extra_conds to pass the reference latents through, then wraps the transformer forward. The reference tokens ride on RoPE frame i+1 - deliberately not coplanar with the target, exactly like the source pipeline.

Installing it

Standard for this pack - ComfyUI Manager (search "Rebels Krea2 Outpaint") or:

cd ComfyUI/custom_nodes
git clone https://github.com/RealRebelAI/ComfyUI-Rebels-Krea2-Outpaint
# restart ComfyUI

No extra Python dependencies. Models are the real checklist: Krea 2 Turbo, the Krea 2 VAE, the Qwen3-VL CLIP, and krea2_outpaint_rank32.safetensors in models/loras.

Where people get burned

  • The GGUF fork caveat. This node reaches into native Krea 2 internals - dit.first, dit.blocks, dit.pe_embedder, dit.patch, and the block attention/module structure. A GGUF loader that swaps the linear ops but keeps that module tree works fine. If your fork renames or restructures those attributes, this is the node you'll have to adjust; the README says so in so many words.
  • Wrong placement JSON. The placement string must come from the Canvas node that also produced your condition and placed_source. Mismatch the runs and the reference gets registered at a stale box - the model anchors to a spot that doesn't match what the composite later restores.
  • Order matters. Patch before the sampler, after the LoRA. Put the patch before Load LoRA and the LoRA's weights won't be in the model the patch operates on, so your registered reference quietly does nothing.
  • Rectangular outpainting only. This is not a mask-based inpainter; interior boxes with canvas on all four sides still need the manual two-pass chaining the pack documents.

Run the pack's workflow graph exactly once with the sample settings (8 steps, euler, CFG 1.0, denoise 1.0) before you improvise - it's well-trodden, and once you see it work, the failure modes become obvious.

CategoryRealRebelAI/krea2_outpaint

Inputs (3)

NameTypeDefaultDescription
modelMODEL
placementSTRING
kv_cacheBOOLEANtrue

Outputs (1)

NameTypeDescription
MODELMODEL