3.6 KiB
3.6 KiB
Krea2 Reference Encoder
Prepares the reference latents for a Krea2-patched model and appends them to your existing text conditioning. The adapter uses RoPE (Rotary Position Embedding) to attend to the references during diffusion without overwriting your text prompt.
How the slots work
The adapter was trained with a fixed slot convention:
| Slot | Input | Resolution | Role |
|---|---|---|---|
| 1 | base_latent |
Must match output | The image being edited, inpainted, or outpainted |
| 2 | reference_latent_2 |
Any | Style / content reference (optional) |
| 3 | reference_latent_3 |
Any | Style / content reference (optional) |
| 4 | reference_latent_4 |
Any | Style / content reference (optional) |
Slot 1 is always the base image — the canvas the model will modify. Slots 2–4 are optional visual references that guide style or content.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
positive |
CONDITIONING | ✅ | Positive text conditioning from a CLIP Text Encode node. The reference payload is appended — your prompt is never overwritten. |
negative |
CONDITIONING | ✅ | Negative text conditioning. Receives the same reference payload as positive. |
base_latent |
LATENT | ✅ | The image to edit / inpaint, VAE-encoded. Must be the same resolution as the generation output. |
strength |
FLOAT | ✅ | Scales all reference latents before storing them. Range: 0.0 – 2.0, default 1.0. |
reference_latent_2 |
LATENT | ➖ | Optional style / content reference, VAE-encoded. |
reference_latent_3 |
LATENT | ➖ | Optional style / content reference, VAE-encoded. |
reference_latent_4 |
LATENT | ➖ | Optional style / content reference, VAE-encoded. |
Outputs
| Name | Type | Description |
|---|---|---|
positive |
CONDITIONING | Positive conditioning with all reference latents embedded under reference_latents. |
negative |
CONDITIONING | Negative conditioning with the same reference payload. |
Usage
Instruct-style editing
Edit an existing image by describing only the change you want.
- Load Image → VAE Encode →
base_latent - Write a prompt describing the change (e.g. "replace the sky with a stormy sunset")
- Connect
positive/negativeto a KSampler whose model comes from Krea2 Model Patcher
Inpainting / outpainting
Fill a masked or extended region while keeping the rest of the image intact.
- Prepare the source image with the unknown region masked (neutral grey or noise)
- VAE Encode the masked image →
base_latent - Prompt for the content that should fill the masked area
Reference-guided generation
Generate a new image that draws style or content from reference images.
- Provide a blank or noise latent (same size as the desired output) →
base_latent - Load style / content reference images → VAE Encode →
reference_latent_2(and optionally_3,_4) - Write a prompt describing the desired output
Notes
base_latentmust match the output resolution — this is a hard constraint from the training data. Mismatched resolutions will produce degraded results.strengthabove1.0amplifies the reference signal and can cause the model to over-fit to the references at the expense of prompt adherence.- Chaining two Krea2 Reference Encoder nodes is supported — the second call accumulates its references onto the first via
torch.cat. - The downstream sampler must use a model patched with Krea2 Model Patcher. An unpatched model will silently ignore the
reference_latentskey in the conditioning metadata.