Krea2 Ostris Edit Model Patch ⚡
The one switch that makes reference-conditioned Krea2 LoRAs work
- model
- MODEL
Krea2 has a whole ecosystem of edit and control LoRAs trained with Ostris's ai-toolkit that don't behave like ordinary LoRAs. They expect reference images injected into the model as extra tokens - the "index_timestep_zero" method, where reference latents get appended to the image sequence at RoPE positions 1, 2, 3… and conditioned at t=0. Load one of those LoRAs with a stock loader and... nothing. There's no comfy-native mechanism to feed it the references it was trained on. This node is that mechanism.
It's a port of ostris/ComfyUI-Krea2-Ostris-Edit (MIT), folded into the CCTech pack so the Ostris-trained LoRAs (things like thedeoxen's krea2_turbo_openpose_controlnet) run without installing a second package. It takes your loaded Krea2 model and patches three things: extra_conds so reference_latents on the conditioning get processed and passed through, the extra-conds shapes, and the diffusion model's forward so the reference tokens land in the right place at the right timestep. Take its model output and it's ready to sample.
The input that matters
Just two required inputs, and one is a switch:
model- your Krea2 MODEL (with the Ostris-trained LoRA already loaded via stockLoraLoaderModelOnly).kv_cache(default off) - this is the interesting one. With it off, the reference tokens ride along in the per-step sequence and the model attends to them every denoising step. With it on, the node precomputes the references' attention keys and values in a single t=0 reference-only pass, then reuses that cache every step instead of re-processing them. That's a real speedup - but only works properly if the LoRA was trained with ai-toolkit'skv_cachemodel kwarg (the pose ControlNet LoRA mentioned above is one). Leave it off for normal edit LoRAs; the results can be wrong if you flip it on for one that wasn't trained for it.
Output is a MODEL, straight into your KSampler.
Pair with its text-encode sibling
This patch does nothing on its own - it needs conditioning that carries the references. That's Krea2 Ostris Edit Text Encode's job: it takes your prompt plus up to three images, feeds them to Qwen3-VL as "Picture N:" vision tokens, VAE-encodes them as reference_latents, and hands you a CONDITIONING. Wire that into positive (and the empty version into negative for CFG > 1) and the patch has something to inject.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/ChrisColeTech/ComfyUI-GGUF-Loader
pip install --upgrade gguf
Restart ComfyUI. The nodes sit under 🤖 CCTech/Krea2. The LoRA itself is a separate download from wherever you got it (CivitAI or HuggingFace), placed in models/loras.
Gotchas
The kv_cache toggle is not a universal speed hack - it's a compatibility flag for a specific training mode. When in doubt, off. And remember this node doesn't load any LoRA; it patches the model so the LoRA's reference conditioning can work. No reference_latents in your conditioning (i.e. the text-encode node's vae disconnected), and you're paying for a no-op patch.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| kv_cache | BOOLEAN | false | Cache the reference tokens' attention K/V: precomputed in one t=0 pass and reused every denoising step, so the refs never ride along in the per-step sequence. The LoRA must be trained with ai-toolkit's kv_cache model kwarg for this to work properly. Leave off for normal edit LoRAs. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |