Krea2 AnyPaint Model Patch
The Krea 2 AnyPaint Model Patch is a speed toggle pretending to be an important node
- model
- MODEL
Two inputs, one output, and yet if you drop this node the whole workflow silently does the wrong thing. Krea2AnyPaintModelPatch is the glue that lets Krea 2 actually use the reference Krea2AnyPaintEncode built. It takes your patched model, registers the semantic reference over the full canvas, and - if you leave its one real setting alone - makes the whole thing fast enough to be fun.
What it does under the hood
The AnyPaint LoRA is a functional LoRA: it was trained to attend to a clean reference image placed at specific coordinates, the same trick the author's Krea 2 ReID and Registered Outpaint adapters use. The model doesn't know about any of that until this node patches the diffusion model's forward pass. Specifically, it:
- wires the reference latents from your conditioning into the model's
extra_conds, so the reference tokens actually reach the attention blocks, and - packs the reference tokens into the target canvas grid (the whole
[0,0] → [1,1]box, normalized) using registered RoPE placement - the exact geometry the LoRA was trained with. This is the part that separates AnyPaint from a plain edit LoRA: the reference doesn't sit off to the side, it's mapped onto the canvas it's describing.
The kv_cache toggle defaults to on, and it's the interesting bit. With it on, the node runs the clean reference tokens through the model once at t=0, captures each attention block's K/V, and reuses that cached set for every denoising step. The reference is the same every step - why recompute it? On an 8-step Turbo run that's a very real speedup. Flip it off and it recomputes the reference joint pass every step; same output, noticeably slower.
The inputs and output
Just two inputs, one of which you will never touch:
model- the model chain coming out ofLoad LoRA(specifically, the AnyPaint LoRA you loaded). Order matters: patch after the LoRA, not before.kv_cache- defaultTrue. Leave it. It's only a speed/VRAM trade-off, not a quality dial.
It returns the patched MODEL, which feeds straight into the KSampler's model input. The sampler itself is stock - 8 steps, Euler, simple scheduler, CFG 1.0 are the recommended Krea 2 Turbo settings - and the conditioning + latent come from Krea2AnyPaintEncode.
Installing it
Same pack, same install as the other two nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/alexw5702-afk/krea2-anypaint
Restart ComfyUI, drop krea2_anypaint_rank32.safetensors into ComfyUI/models/loras, and make sure the Krea 2 diffusion model, Qwen3-VL text encoder, and Qwen-Image VAE are all in place. Nothing else to install - no custom sampler, no extra Python deps.
Where people get burned
The classic failure is forgetting this node entirely: load the LoRA, run the sampler, and get output that looks like it never saw your source, because the reference path was never activated. The README's advice to put it "after Load LoRA and before KSampler" is load-bearing - if you patch the base model before the LoRA lands, the LoRA's own patching can fight yours. And don't confuse this with the old registered-outpaint composite approach from earlier Krea 2 packs: AnyPaint already preserves known pixels during every denoising step, so there's nothing to stitch back afterward. If your output has a visible seam where source meets generated content, the fix lives in Krea2AnyPaintPrepare's boundary_redraw_px, not here.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| kv_cache | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |