Nodes/ComfyUI-PiD/PiD Prepare
ComfyUI Node

PiD Prepare

The staging node that loads PiD's heavy models once

By Merserk·Created 3 months ago·Updated 2 months ago· 122
PiD Prepare
  • latent
  • prepared
versionv1
backbonezimage
pid_ckpt_type2k
scale0
sigma0.000
auto_downloadtrue
model_precisionbf16
cleanup_after_preparetrue
caption

PiD Prepare is the first of the three staged nodes, and its job is boring in the best way: it validates your latent, moves it out of VRAM, downloads the PiD diffusion model and Gemma text encoder if they're missing, figures out the effective sigma, and bundles everything into one PID_PREP object. Then PiD Sample runs the actual decode. Splitting the work like this is what lets low-VRAM setups survive - by the time the heavy PiD model loads, your latent is sitting safely on CPU.

It's also the node that makes PiD self-explanatory when you feed it a capture: if the latent carries a pid_sigma from PiD KSampler Capture, it uses that automatically, so you don't have to remember to forward a number.

How it works

The prepare step resolves the full spec for your version/backbone/pid_ckpt_type/model_precision combination, validates that the latent's channel count matches the backbone (16 for Flux-family, 128 for Flux2, 4 for SDXL), moves the latent to CPU, computes the base image size and the final inferred size, and - if cleanup_after_prepare is on - aggressively frees CUDA memory so PiD Sample has room to load the decoder. The PID_PREP it returns is an internal pack type; you don't poke at it, you just pass it to PiD Sample.

Inputs that matter

  • latent - wire pid_latent from PiD KSampler Capture, or any latent you want PiD to decode (including from PiD Empty Latent Image).
  • backbone - must match the latent's family, or you'll get a channel-count error. Ten choices.
  • pid_ckpt_type - 2k (512-class) or 2kto4k (1024-class). This decides the base size PiD decodes from and therefore the final resolution.
  • scale - 0 or 4 are the recommended values (4 is the native checkpoint scale for the released checkpoints).
  • sigma - fallback sigma used only if the latent doesn't carry one; leave at 0 and let a captured pid_sigma win.
  • caption - the text conditioning for the decode. Wire PiD Text Prompt or PiD Caption Creator here.
  • auto_download - on by default; downloads the diffusion model and text encoder into ComfyUI/models/diffusion_models/nvidia_pid/ and text_encoders/nvidia_pid/ on first run.

model_precision (default bf16, the quality pick; fp8/int8 only where supported) and version (v1/v1.5) round out the required set.

The staged workflow

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

The staged path exists precisely so you can stop, look at the memory log between stages, and not have the whole generation and the whole decode fighting for the same VRAM at once.

Setup and gotchas

Same pack install as the rest: ComfyUI Manager → "ComfyUI-PiD", or git clone https://github.com/Merserk/ComfyUI-PiD.git into ComfyUI/custom_nodes, pip install -r requirements.txt, restart. Requires a recent ComfyUI with native PixelDiT support (0.28.0+) and Python 3.10+.

Where people get tripped up:

  • Mismatched latent. This is the most common error - feeding an SD1.5/SDXL-shaped latent with backbone=flux or similar. The node tells you exactly what it expected ("Flux PiD expects 16-channel latents, got 4 channels"), so the fix is always "encode with the right VAE or use PiD Empty Latent Image."
  • First run is slow. PiD Prepare downloads potentially gigabytes of model files if auto_download is on and the folder is empty. That's a one-time cost, not a hang.
  • Unsupported combos error on purpose. e.g. fp8 with a backbone that doesn't ship it - the selectors in the UI usually prune these, but old workflows hit the backend check. Switch to bf16 and move on.
CategoryPiD/Staged

Inputs (10)

NameTypeDefaultDescription
latentLATENT
versionCOMBOv12 options: v1, v1.5
backboneCOMBOzimage10 options: zimage, zimage-turbo, flux, flux2, flux2-klein-4b, flux2-klein-9b, +4
pid_ckpt_typeCOMBO2k2 options: 2k, 2kto4k
scaleINT00–8
sigmaFLOAT0.0000–1000
auto_downloadBOOLEANtrue
model_precisionCOMBObf163 options: bf16, fp8, int8
cleanup_after_prepareBOOLEANtrue
captionSTRING

Outputs (1)

NameTypeDescription
preparedPID_PREP