Nodes/ComfyUI-Replicate/Replicate fofr/latent-consistency-model
ComfyUI Node

Replicate fofr/latent-consistency-model

Fast LCM generation with ControlNet

By replicate·Created 2 years ago·Updated 2 years ago· 207
Replicate fofr/latent-consistency-model
  • image
  • control_image
  • IMAGE
promptSelf-portrait oil painting, a beautiful cyborg with golden hair, 8k
width768
height768
sizing_strategywidth/height
prompt_strength0.80
num_images1
num_inference_steps8
guidance_scale8.00
lcm_origin_steps50
seed
controlnet_conditioning_scale2.00
control_guidance_start0.00
control_guidance_end1.00
canny_low_threshold100.00
canny_high_threshold200.00
archive_outputsfalse
disable_safety_checkerfalse
force_rerunfalse

LCM - Latent Consistency Models - was the first distillation approach cheap enough for the whole community to adopt, the thing that made real-time and near-instant generation normal. It jumps to a result in a handful of steps instead of the usual 20-50. This node, from fofr, wraps an LCM model that also takes an input image (img2img) and a ControlNet control image, and runs it on Replicate's cloud via ComfyUI-Replicate.

It's more than a bare text-to-image node - the img2img and Canny-ControlNet inputs make it a small pipeline in one box: generate from scratch, transform an existing image, or guide the output with edges.

How it works

LCM learns to predict the final image directly by solving the diffusion ODE in latent space, collapsing many steps into a few. That's why it defaults to 8 steps and low guidance - the same distilled-model rules as Lightning and Hyper-SD: keep steps low and CFG modest or you'll fight the baked-in guidance. This node adds optional img2img (image + prompt_strength) and a Canny ControlNet path (control_image + conditioning scales) on top. The node calls Replicate and returns an IMAGE.

Inputs and outputs that matter

Output is an IMAGE.

  • prompt - your text.
  • num_inference_steps (8) - LCM's sweet spot is roughly 4–8. Don't push it high.
  • guidance_scale (8 here) - LCM tolerates a bit more than a 0-CFG Lightning model, but keep it moderate.
  • image + prompt_strength (0.8) - for img2img: wire in a source image and let prompt_strength set how far it moves from it (higher = more change).
  • control_image + controlnet_conditioning_scale (2) - for ControlNet: feed a Canny-friendly image and control how strongly its edges steer the result. canny_low_threshold / canny_high_threshold tune the edge detection.
  • sizing_strategy - whether output size follows width/height, the input image, or the control image.

num_images batches up to 50 (LCM is cheap enough that big batches make sense), seed fixes the roll, and force_rerun forces a fresh generation.

How to install it

ComfyUI Manager: search ComfyUI-Replicate, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/replicate/comfyui-replicate
cd comfyui-replicate
pip install -r requirements.txt

Restart, and set your token first:

export REPLICATE_API_TOKEN="r8_************"; python main.py

Token: replicate.com/account/api-tokens.

Common issues

Image output, cleanly supported - no pack caveats.

The distillation rules bite here as everywhere: if results look muddy or artifacted, check you haven't cranked num_inference_steps or guidance_scale - LCM is a rapid-preview tool, and the community is honest that it doesn't maintain or improve quality the way a full model does. It's for finding good compositions fast, not for the final render. If the img2img output ignores your source, prompt_strength is too high; if it barely changes anything, it's too low. If ControlNet isn't biting, raise controlnet_conditioning_scale or check your control image actually has clean edges for Canny to find.

Standard pack reminder: a missing REPLICATE_API_TOKEN is the first-run error, and every call bills on Replicate.

CategoryReplicate

Inputs (20)

NameTypeDefaultDescription
promptoptSTRINGSelf-portrait oil painting, a beautiful cyborg with golden hair, 8k
widthoptINT768
heightoptINT768
sizing_strategyoptCOMBOwidth/height3 options: width/height, input_image, control_image
imageoptIMAGE
prompt_strengthoptFLOAT0.800–1
num_imagesoptINT11–50
num_inference_stepsoptINT81–50
guidance_scaleoptFLOAT8.001–20
lcm_origin_stepsoptINT50
seedoptINT
control_imageoptIMAGE
controlnet_conditioning_scaleoptFLOAT2.000.1–4
control_guidance_startoptFLOAT0.000–1
control_guidance_endoptFLOAT1.000–1
canny_low_thresholdoptFLOAT100.001–255
canny_high_thresholdoptFLOAT200.001–255
archive_outputsoptBOOLEANfalse
disable_safety_checkeroptBOOLEANfalse
force_rerunoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE