ComfyUI Node

LCMLora_inpaint

The generate node that does everything in the Lora line

By taabata·Created 3 years ago·Updated 2 years ago· 259
LCMLora_inpaint
  • mask
  • image
  • reference_image
  • pipe
  • IMAGE
seed0
text
steps4
width512
height512
cfg1.8
reference_style_fidelity0.5
batch1
strength1.0
prompt_weighting
controlnet_weight1.0
reference_only
ip_adapter
ipadapter_scale1.00

This is the workhorse. Where the older LCMLoader/LCMGenerate pair use a dedicated LCM checkpoint (Dreamshaper v7 in diffusers format), the LCMLora line uses an LCM-LoRA on top of a normal model - the approach that ended up winning. One small adapter file turns any SD 1.5 checkpoint into a 4-step model, and LCMLora_inpaint is where the magic actually runs: it's a full generate node with inpainting, reference-only conditioning, IP-Adapter, and optional Compel prompt weighting all selectable on the same node.

It expects a pipe from LCMLoraLoader_inpaint (the loader that builds the LCM-LoRA pipeline and loads the ControlNet + IP-Adapter). The output is an IMAGE - a batch of generated images you can feed straight to a save node.

How it works

It converts your ComfyUI tensors to PIL, then calls the diffusers pipeline with whatever you've toggled on. The three toggles are independent:

  • reference_only - enable passes a ref_image + reference_style_fidelity to the pipeline for example-driven style.
  • ip_adapter - enable routes the same reference image through the IP-Adapter path with ipadapter_scale, which the loader has to have prepared (it calls load_ip_adapter at load time, so the model file must exist in models/controlnet/IPAdapter/models).
  • prompt_weighting - enable swaps the prompt for Compel-processed embeddings, giving you (word:1.2)-style weighting. Remember the README's warning: this one requires CPU inference, so the loader's device should be set to CPU.

It runs the batch as a loop, rolling a fresh random seed per image, and strength controls how much of the input image survives. Keep the LCM defaults - steps 4, cfg 1.8 - and you're in the right territory.

The inputs that matter

Honestly, most of them. The few you'll touch constantly:

  • pipe - the class output from LCMLoraLoader_inpaint.
  • mask and image - the inpaint pair. Image is your base, mask is where it regenerates (white = repaint).
  • reference_image - feeds reference-only and/or IP-Adapter.
  • text, steps, cfg - prompt, 4 steps, CFG ~1.8.
  • controlnet_weight - how hard the ControlNet loaded by the loader pushes the result (0–1).

Output: IMAGE - wire it into SaveImage_LCM or any ComfyUI image output.

How to install it

Part of taabata/LCM_Inpaint-Outpaint_Comfy - one install gets every node:

cd ComfyUI/custom_nodes
git clone https://github.com/taabata/LCM_Inpaint-Outpaint_Comfy
cd LCM_Inpaint-Outpaint_Comfy
pip install -r requirements.txt

Or via ComfyUI Manager (search "LCM_Inpaint_Outpaint_Comfy"), then restart. The loader side needs: your base SD 1.5 model as a diffusers folder in models/diffusers/, the LCM-LoRA pytorch_lora_weights.safetensors in models/loras/, a ControlNet folder in models/controlnet/, and if you want IP-Adapter, its model file under models/controlnet/IPAdapter/models/. Optional TAESD in models/vae/taesd speeds up previews.

Common issues

The most common failure is actually in the loader, not this node: pytorch_lora_weights.safetensors missing from models/loras/ makes the whole load error. The IP-Adapter toggle is the other gotcha - if the model file isn't in exactly models/controlnet/IPAdapter/models/, the dropdown is empty and enable will fail.

And the prompt-weighting/GPU trap is real: leave prompt_weighting on with a GPU loader and it errors. Either run CPU or leave it disabled.

CategoryLCM_Nodes/nodes

Inputs (18)

NameTypeDefaultDescription
seedINT00–18446744073709550000
textSTRING
stepsINT40–360
widthINT5120–5000
heightINT5120–5000
cfgFLOAT1.80–3
maskIMAGE
imageIMAGE
reference_imageIMAGE
reference_style_fidelityFLOAT0.50–1
pipeclass
batchINT11–100
strengthFLOAT1.00–1
prompt_weightingCOMBO2 options: disable, enable
controlnet_weightFLOAT1.00–1
reference_onlyCOMBO2 options: disable, enable
ip_adapterCOMBO2 options: disable, enable
ipadapter_scaleFLOAT1.000–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE