Nodes/ComfyUI-PiD/PiD Sample
ComfyUI Node

PiD Sample

Where the pixel diffusion actually runs

By Merserk·Created 3 months ago·Updated 2 months ago· 122
PiD Sample
  • prepared
  • sampled
pid_steps4
cfg_scale1.0
seed0
aggressive_cleanuptrue

Middle child of the staged trio. PiD Prepare assembled the payload, PiD Finalize will turn it into an image - and PiD Sample is the part that actually runs the NVIDIA pixel-diffusion decode. It takes a PID_PREP object in, runs the distilled denoising, and hands a PID_SAMPLES object to PiD Finalize. If you're using the staged path, this is the node where the heavy lifting (and most of the VRAM) lives.

It's deliberately thin, because almost everything was decided upstream in PiD Prepare. You get a handful of knobs, all with sensible defaults.

The inputs

  • prepared - the PID_PREP object from PiD Prepare. Nothing else feeds this input; it's the pack's own type.
  • pid_steps - default 4. The Comfy-Org PiD models are 4-step distilled, so 4 is the sweet spot. The node prints a warning if you change it, because any other step count is experimental and out of distribution - more steps doesn't linearly mean "better," it means "different, probably worse."
  • cfg_scale - default 1.0. A distilled decoder, so classifier-free guidance of 1 is correct. This is not your LDM's CFG; don't crank it.
  • seed - for reproducible detail.
  • aggressive_cleanup - default true; frees CUDA memory aggressively when sampling finishes so the next stage (or your next queue item) starts with a clean slate.

How it works

The node runs the native PiD sampling on the prepared batch - loading the diffusion model and Gemma text encoder paths that PiD Prepare resolved, decoding from the CPU-staged latent, and producing a pixel-space tensor. The progress is reported through a PiD progress bar, and the output is a PID_SAMPLES object rather than a raw image; that conversion is PiD Finalize's job. The staging is the whole point: your generation finished earlier, freed its VRAM, and only now does PiD's decoder load in for a focused run.

The workflow

PiD KSampler Capture -> pid_latent -> PiD Prepare -> PiD Sample -> PiD Finalize -> Save Image

You can also run the same staged path from any latent (e.g. PiD Empty Latent Image, or an img2img encode) - just feed it through PiD Prepare and into PiD Sample.

Setup and gotchas

One install for the pack: ComfyUI Manager → "ComfyUI-PiD", or git clone https://github.com/Merserk/ComfyUI-PiD.git into ComfyUI/custom_nodes, pip install -r requirements.txt, then restart. Needs recent ComfyUI (0.28.0+) and Python 3.10+.

Real-world notes:

  • It's the memory spike. The decode of a 2kto4k latent to ~4096 is where OOMs happen. If you crash here, drop to 2k, and double-check aggressive_cleanup is on.
  • Step count ≠ quality ladder. Leave pid_steps at 4. The distilled checkpoints were trained for exactly this trajectory; the warning in the console isn't flavor text.
  • Don't wire it directly to Save Image. PiDSample outputs PID_SAMPLES, not IMAGE - that's what PiD Finalize is for. Missing that hop is the most common wiring mistake, and it's an easy one to make on first build.
CategoryPiD/Staged

Inputs (5)

NameTypeDefaultDescription
preparedPID_PREP
pid_stepsINT41–64
cfg_scaleFLOAT1.00–20
seedINT00–2147483647
aggressive_cleanupBOOLEANtrue

Outputs (1)

NameTypeDescription
sampledPID_SAMPLES