Nodes/Disco Diffusion/Disco Diffusion Sampler
ComfyUI Node

Disco Diffusion Sampler

The sampler that turns a prompt into a lighthouse on a sea of blood

By space-nuko·Created 3 years ago·Updated 2 years ago· 62
Disco Diffusion Sampler
  • guided_diffusion
  • guided_clip
  • init_image
  • extra_settings
  • IMAGE
text; How to prompt: ; Each line is prefixed with the starting step number of the prompt. ; More than one line with the same step number concatenates the two prompts together. ; Each individual prompt can be no more than 77 CLIP tokens long. ; Weights are parsed from the end of each prompt with "25:a fluffy fox:5" syntax ; Comments are written with the ';' character. Blank lines are ignored. 0:A beautiful painting of a singular lighthouse, shining its light across a tumultuous sea of blood by greg rutkowski and thomas kinkade. Trending on artstation. 0:yellow color scheme ;100:This set of prompts starts at step 100. ;100:This prompt has weight five:5
width1280
height768
seed0
steps250
skip_steps0
n_batches1
sampling_modeddim
clip_guidance_scale1500.00
tv_scale0.00
range_scale150.00
sat_scale0.00

If the default prompt in this node looks like a fever dream - "A beautiful painting of a singular lighthouse, shining its light across a tumultuous sea of blood by greg rutkowski and thomas kinkade" - that's because Disco Diffusion is where AI art went mainstream in 2022, a few months before Stable Diffusion existed. This is the node that made that happen, ported into ComfyUI. It is not a KSampler. Don't go looking for CFG, a negative prompt box, or a latent input; you won't find any of them, and that's the point.

How it works

ComfyUI's normal sampler denoises a latent and cross-attends to pre-encoded text. Disco does something older and weirder: CLIP-guided diffusion. At every denoising step the node crops the current image into a stack of random cutouts, embeds them with a CLIP vision tower, compares them against the embedding of your prompt using a spherical-distance loss, and then backprops that loss through the image so the next step nudges the whole painting closer to your words.

That's why clip_guidance_scale defaults to 1500 - this isn't classifier-free guidance around 7, it's a raw gradient multiplied by a huge number. range_scale (default 150) keeps pixels inside [-1, 1], and tv_scale / sat_scale are there when you want to fight noise or oversaturation. Because the gradient has to flow through the model, the whole pack deliberately loads with autograd enabled, overriding ComfyUI's default inference mode. The author leaves a note about exactly this in the source.

The prompt syntax

There's no prompt box like you're used to. Each line starts with the step number where the prompt kicks in:

; Comments use a semicolon. Blank lines are ignored.
0:A beautiful painting of a lighthouse by greg rutkowski and thomas kinkade.
0:yellow color scheme
100:This starts at step 100.
100:This line has weight five:5

Lines sharing a step number get concatenated, which is how you get around CLIP's hard 77-token limit per line - the node lets you chain as many lines as you want. The trailing :5 is a weight. You can go negative, but the sum of all weights can't be zero, or the run errors out.

The inputs that matter

  • text - the step-numbered prompt block above. This is 90% of your work.
  • guided_diffusion and guided_clip - from the Guided Diffusion Loader and the Guided Diffusion CLIP Loader. Nothing works without both.
  • width / height - defaults of 1280x768 suit 512px models; drop to 512x448 for the 256px line.
  • steps (250), skip_steps (0), seed, n_batches - self-explanatory. Batches output a list of images.
  • sampling_mode - plms, ddim (default), and the two exotic stsp / ltsp modes inherited from Disco's fork of guided-diffusion. ddim and plms are the battle-tested ones; the others are experiments.
  • init_image (optional) - a starting image; the node saves it to ComfyUI's temp dir and uses LPIPS loss to hold composition.

The single IMAGE output (a list, one per batch) wires straight into a Save Image or Preview node.

Installing it

Via ComfyUI Manager, search "Disco Diffusion" and hit install. Manually:

cd ComfyUI/custom_nodes
git clone --recursive https://github.com/space-nuko/ComfyUI-Disco-Diffusion
cd ComfyUI-Disco-Diffusion
# in the SAME virtualenv your ComfyUI uses:
pip install -r requirements.txt

The --recursive isn't decorative - the pack vendors guided-diffusion, open_clip, CLIP, MiDaS and RAFT as submodules. On first load, models auto-download into ComfyUI/models/Disco-Diffusion, each a gigabyte-plus with SHA256 verification, and the pack always pulls the "secondary" helper model too. Expect slow: 250 steps at 1280x768 on these 256-channel UNets is minutes per image, not seconds.

Where people get burned

The venv mistake is the classic one - pip install landing in a system Python instead of ComfyUI's environment, which shows up as a wall of import errors. The bigger honest caveat: this pack's last commit was mid-2023, and the ComfyUI API has drifted a lot since. If your whole ComfyUI refuses to boot right after installing, this is the first suspect, and nobody in the subreddit in 2026 can confirm it runs clean on a current build. Treat it as a museum piece that's magical when it works - not as something to build your daily workflow on.

Categorysampling

Inputs (16)

NameTypeDefaultDescription
textSTRING; How to prompt: ; Each line is prefixed with the starting step number of the prompt. ; More than one line with the same step number concatenates the two prompts together. ; Each individual prompt can be no more than 77 CLIP tokens long. ; Weights are parsed from the end of each prompt with "25:a fluffy fox:5" syntax ; Comments are written with the ';' character. Blank lines are ignored. 0:A beautiful painting of a singular lighthouse, shining its light across a tumultuous sea of blood by greg rutkowski and thomas kinkade. Trending on artstation. 0:yellow color scheme ;100:This set of prompts starts at step 100. ;100:This prompt has weight five:5
guided_diffusionGUIDED_DIFFUSION_MODEL
guided_clipGUIDED_CLIP
widthINT128064–2048
heightINT76864–2048
seedINT00–18446744073709550000
stepsINT2501–10000
skip_stepsINT00–10000
n_batchesINT11–16
sampling_modeCOMBOddim4 options: plms, ddim, stsp, ltsp
clip_guidance_scaleFLOAT1500.001–10000000
tv_scaleFLOAT0.000–100000
range_scaleFLOAT150.000–100000
sat_scaleFLOAT0.000–100000
init_imageoptIMAGE
extra_settingsoptDISCO_DIFFUSION_EXTRA_SETTINGS

Outputs (1)

NameTypeDescription
IMAGEIMAGE