Open-source project
ostris/ComfyUI-Krea2-Ostris-Edit avatar
ostris/ComfyUI-Krea2-Ostris-Edit

ComfyUI-Krea2-Ostris-Edit: how reference latents reach a Krea 2 model

Comfy UI Nodes for Krea 2 LoRAs trained with AI Toolkit Experimental Edit

375 stars16 forksPythonMIT

At a glance

What is it?
Two ComfyUI nodes for Krea 2 edit LoRAs trained with ai-toolkit. One encodes the prompt plus up to three reference images through the Qwen3-VL text encoder, the other patches the diffusion model so it reads those references at all.
Who is it for?
Adopt this pair when your Krea 2 edit LoRA came out of ai-toolkit on the krea2 architecture with model_kwargs.edit: true, and when your text encoder checkpoint carries the Qwen3-VL vision weights. Both conditions are stated in the node descriptions and neither is visible from the graph.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 121 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • ostris/ComfyUI-Krea2-Ostris-Edit375 ★ · +41
Star history
Repository2026-09-192026-11-15
ostris/ComfyUI-Krea2-Ostris-Edit334375

41 Stars in the last 57 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Cloning into custom_nodes, with no dependency step

Installing means cloning the repository into the ComfyUI custom_nodes folder and restarting ComfyUI:

bash
cd ComfyUI/custom_nodes
git clone https://github.com/ostris/ComfyUI-Krea2-Ostris-Edit.git

No extra dependencies are required, and pyproject.toml agrees by declaring an empty `dependencies = []`. The repository root holds .comfyignore, .github/, .gitignore, LICENSE, README.md, __init__.py, nodes.py, pyproject.toml and workflow/, so there is no requirements file to resolve and no build step to run before the nodes load. After the restart they appear under the `ostris/krea2` category. That category matches the publisher id declared in pyproject.toml, while the display name shown in the node list is `Krea 2 Ostris Edit`, a shorter string than the repository name. The project is MIT licensed, with pyproject.toml pointing at the LICENSE file rather than restating the terms. The version string in pyproject.toml is 1.0.1.

Text Encode Krea 2 Ostris Edit takes a prompt and up to three reference images

The encode node accepts `clip`, `prompt`, and optionally `vae` plus `image1` through `image3`, and returns `CONDITIONING`. Prompt and reference images travel through the Krea 2 Qwen3-VL text encoder together, laid out with Krea's conditioning template and its `Picture N:` vision placeholders. Matching the training layout is the reason for that template: the edit LoRA was fitted against this exact arrangement, and a different placeholder scheme would put the image markers where the model was not trained to find them.

The `vae` socket is what turns those references into something the diffusion side can use. When a VAE is connected, every reference image is additionally VAE-encoded and attached to the conditioning as reference latents, where the model patch node can find them. Disconnect the VAE and the node still returns CONDITIONING, but the conditioning carries no reference latents, which puts the graph in the plain text case described further down.

Two pixel budgets: 384x384 for the vision tower, 1MP for the latents

Image sizing matches training, and the two paths run on different budgets. Images fed to the Qwen3-VL encoder are downscaled, never upscaled, until they fit 384x384 total pixels. The VAE-encoded reference latents are sized to fit 1MP. Neither path enlarges a small input, so a thumbnail reference arrives smaller than you typed it, and a large photo loses fine detail before the vision tower ever sees it. The two budgets also rank differently: the encoder budget is far tighter than the latent budget, so the vision tower is the stage that decides how much of a reference survives.

Neither budget is exposed as a node input. The only sockets on this node are `clip`, `prompt`, `vae` and the three image slots, which leaves no room for tuning the resize behaviour from the graph.

A checkpoint without Qwen3-VL vision weights silently loses the images

The catch on the encoder side is blunt: the text encoder checkpoint must include the Qwen3-VL vision weights, or the images cannot be encoded. That makes this a checkpoint selection problem rather than a node setting. It fails quietly in a specific way, because a CLIPLoader slot filled with a text-only Krea 2 encoder will still accept the image connections while having no vision tower to run them through, leaving you with conditioning that carries no image content.

There is a second requirement of the same shape, and it applies to the LoRA rather than the encoder. These nodes target LoRAs trained with ai-toolkit on the `krea2` architecture with `model_kwargs.edit: true`. An edit LoRA fitted under a different setup falls outside what this encode and patch pair was built for, however carefully the graph is wired.

The model patch exists because stock Krea 2 ignores reference latents

The second node accepts `model` and `kv_cache`, with `kv_cache` defaulting to off, and returns `model`. It patches Krea 2 so the model consumes the reference latents carried by the conditioning. Each reference is appended to the image token sequence and conditioned at timestep 0, the method the code calls `index_timestep_zero`, and the denoising prediction covers only the target image tokens rather than the references as well.

The reason the node exists at all is that the stock Krea 2 model in ComfyUI ignores reference latents. An edit LoRA without this node in the graph has nothing to read, so a graph can look complete and still return an edit that never saw the picture you fed it.

One property makes the node cheap to keep around: when the conditioning carries no reference latents, the patched model behaves exactly like the stock model, so it is safe to leave in a graph that also handles non-edit work.

kv_cache reuses reference K/V and asks for a matching training run

`kv_cache` switches on caching of the reference tokens' attention K/V. Those values are precomputed in a single t=0 pass and reused on every denoising step, so the references never ride along in the per-step sequence. The saving grows with step count, since a cached reference contributes nothing to the per-step sequence length.

The catch is a training mismatch. The LoRA must be trained with ai-toolkit's `kv_cache` model kwarg for this to work properly, and normally trained edit LoRAs should leave it off. The two features also meet at the same moment: timestep 0 is where `index_timestep_zero` injects the references, and it is the pass kv_cache exploits to precompute them. That makes the toggle a statement about how the LoRA was fitted rather than a speed setting to try on any checkpoint.

The example graph and what each arrow is fixing

The wiring is short enough to read in one screen:

code
Load Diffusion Model (krea2) -> Load LoRA -> Krea 2 Ostris Edit Model Patch -> KSampler
CLIPLoader (krea2) -> Text Encode Krea 2 Ostris Edit (prompt + images + VAE) -> positive
CLIPLoader (krea2) -> Text Encode Krea 2 Ostris Edit (negative prompt)      -> negative

Three details in those lines do real work. The patch sits between Load LoRA and KSampler, which is the point where the reference latents become readable; moving it downstream of KSampler changes nothing. The positive branch is the only one carrying images and a VAE, so it is the only one producing reference latents at all. The negative branch is text only, which is why a negative prompt needs no reference and no VAE connection. A workflow/ directory sits at the top level of the repository next to __init__.py and nodes.py, so there is somewhere to keep saved graphs that use this pair.

Editorial conclusion

Adopt this pair when your Krea 2 edit LoRA came out of ai-toolkit on the krea2 architecture with model_kwargs.edit: true, and when your text encoder checkpoint carries the Qwen3-VL vision weights. Both conditions are stated in the node descriptions and neither is visible from the graph. Leave it out of a stock Krea 2 setup or a text-only encoder, where the patch falls back to stock behaviour and the images never get encoded. Before wiring, check three things: the arch and edit flag on the LoRA, whether kv_cache was used at training time, and the vision weights in the checkpoint. This repository has no GitHub releases, and its last push to main is dated 17 July 2026, so pin a commit rather than tracking the branch.

Frequently asked questions

Can Krea 2 edit images?

Not with the stock ComfyUI Krea 2 model, which ignores reference latents. These two nodes supply the missing path: an encode node that turns the prompt plus up to three reference images into reference latents, and a patch node that appends each reference to the image token sequence at timestep 0 so the denoising prediction can read it.

What is the Krea 2 Identity Edit LoRA workflow and how does it work?

Load Diffusion Model (krea2) feeds Load LoRA, then Krea 2 Ostris Edit Model Patch, then KSampler. A CLIPLoader (krea2) with the prompt, images and a VAE feeds positive, and a second CLIPLoader (krea2) with only the negative prompt feeds negative. The patch node in the middle is the required step that lets the model consume the reference latents.

How to use Krea 2?

For edit LoRAs trained with ai-toolkit, clone this repository into the ComfyUI custom_nodes folder, restart ComfyUI, and pick the nodes up from the ostris/krea2 category. No extra dependencies are needed, and the nodes show up as Text Encode Krea 2 Ostris Edit and Krea 2 Ostris Edit Model Patch.

Official sources

  1. Issues
  2. License: MIT
  3. ostris/ComfyUI-Krea2-Ostris-Edit on GitHub
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/ostris-comfyui-krea2-ostris-edit.svg)](https://hysenlabs.com/projects/ostris-comfyui-krea2-ostris-edit)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/ostris-comfyui-krea2-ostris-edit.svg)](https://hysenlabs.com/projects/ostris-comfyui-krea2-ostris-edit)

Was this useful?