Instructions to use Cierpliwy/krea2-inpaint-edit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Cierpliwy/krea2-inpaint-edit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("krea/Krea-2-Raw", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Cierpliwy/krea2-inpaint-edit") prompt = "masked image / this LoRA / yijunwang2-krea2-anypaint" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Krea 2 inpaint edit

- Prompt
- masked image / this LoRA / yijunwang2-krea2-anypaint
LoRAs for Krea-2-Raw that perform inpainting by masked editing: you provide an image with the region to (re)generate filled in black, plus a text prompt describing what should go there — the model paints the masked region while leaving the rest of the image untouched.
The gallery below compares the results of this LoRA against yijunwang2/krea2-anypaint (column 3), with per-row difference maps.
Files
Recommended: krea2_inpaint_edit_v2_17500.safetensors (repo root) — the best checkpoint of the v2 512px training run. It covers everything the original LoRAs did (masked inpainting, editing) plus outpainting (extending a scene into black padding), and generalizes to other resolutions.
All training runs are archived in subfolders, best checkpoints only:
| Path | File | Notes |
|---|---|---|
./ |
krea2_inpaint_edit_v2_17500.safetensors |
recommended — v2 512px run, step 17500 (rank 64) |
v2_512/ |
inpaint_p1_512_v2_000017500.safetensors |
same file as the recommended one (original checkpoint name) |
v2_512/ |
inpaint_p1_512_v2_000020000.safetensors |
end-of-run v2 checkpoint (step 20000), grades nearly identically |
v1_1024/ |
inpaint_p1_1024_000017500.safetensors |
best 1024px-run checkpoint (step 17500) |
v1_1024/ |
inpaint_p1_1024_000019000.safetensors |
second-best 1024px-run checkpoint (step 19000) |
v1_512/ |
krea2_inpaint_edit.safetensors |
v1 512px — default strength |
v1_512/ |
krea2_inpaint_edit_mild.safetensors |
v1 512px — less changes to non-masked areas; better at inpainting areas covering the main focus point |
v1_512/ |
krea2_inpaint_edit_strong.safetensors |
v1 512px — better at outpainting; adapts more strongly to the prompt |
Notes on the runs:
- v1 512 (
v1_512/): the original series — random black masks, no outpainting examples. - v1 1024 (
v1_1024/): same recipe at 1024px; the two checkpoints above were the top of that run. - v2 512 (
v2_512/): 512px retrain (~10k–20k steps, rank 64) where ~10% of the masks are outpainting masks (a rectangular island of the image visible, the rest black). This is what gives it real outpainting capability. Side by side, the v2 512 checkpoints graded clearly ahead of both the v1 series and the v1 1024 checkpoints on inpainting, outpainting, rotation and custom edits.
Requirements
- ComfyUI
- ComfyUI-Krea2-Ostris-Edit — Krea 2 edit nodes (
TextEncodeKrea2OstrisEdit,Krea2OstrisEditModelPatch). kv_cache onKrea2OstrisEditModelPatchmust be enabled (it is disabled by default) — this is important for correct masked editing.- Inputs above 1MP: until ostris/ComfyUI-Krea2-Ostris-Edit#10 is merged, install the vlm-ref-size-inputs branch of the fork instead, which allows reference images higher than 1MP.
- Krea-2-Raw base model weights: krea/Krea-2-Raw
The example workflows only use official ComfyUI nodes (including comfy_extras) plus the Ostris edit nodes above.
Quick start
- Download the LoRA you want (Files & versions tab) and put it in
ComfyUI/models/loras/. - Mask your image: fill the region you want to (re)generate with solid black — the mask can cover part or all of the image.
- Load any example workflow from the
workflows/folder into ComfyUI (Workflow → Open). - Connect your masked image to the
image1input of the inpaint TextEncodeKrea2OstrisEdit node (the one after the LoRA loader) — replacing the auto-generated reference the workflow feeds it by default. - In that TextEncodeKrea2OstrisEdit node, write a prompt describing what should appear in the masked region (style, colors, content).
- Make sure kv_cache is enabled on the Krea2OstrisEditModelPatch node (it is disabled by default).
- Queue the prompt.
Example workflows
All example workflows live in the workflows/ folder. Each one first generates a base image with stock Krea-2, builds the black-masked reference from it, then runs the inpaint-edit LoRA to fill the black region.
| Workflow | What it does | Extra models needed |
|---|---|---|
workflows/outpaint_example.json |
Generates an image, pads it onto a larger black canvas (Image Composite Masked) and extends the scene into the black border | — |
workflows/background_replacement_example.json |
Generates an image, removes the background (BiRefNet via RemoveBackground) and composites the foreground onto black, then inpaints a new background | birefnet.safetensors → models/bg_removal/ |
workflows/moge_rotate_inpaint_example.json |
Generates an image, estimates geometry with MoGe-3, converts it to a textured mesh, rotates the mesh and renders it on a black background, then inpaints the scene around the new viewpoint | moge_3_vitl_fp16.safetensors → models/geometry_estimation/ |
workflows/sam3_detect_example.json |
Generates an image, detects the subject with SAM 3 open-vocabulary text detection, composites the detected object onto black, then inpaints a new background around it | sam3.safetensors → models/checkpoints/ (loaded via CheckpointLoaderSimple, which also provides the SAM 3 text encoder) |
If you change the base generation size or the canvas size in any of these workflows, keep the composite offsets / canvas dimensions in sync.
- Downloads last month
- 2,149
Model tree for Cierpliwy/krea2-inpaint-edit
Base model
krea/Krea-2-Raw