Anima PiD Decode (4x SR)
Swap VAE Decode for a node that decodes AND upscales to 4K in one 4-step pass
- pid_model
- latent
- IMAGE
You generate a 1024px Anima image and want a 4096px version without the usual two-stage rig: ESRGAN upscale, then an img2img pass at low denoise, then hoping the ControlNet Tile seams don't show. Anima PiD Decode (4x SR) collapses that into one node. It takes a LATENT straight off the KSampler and emits a 4× super-resolved IMAGE in a single 4-step diffusion pass. No second KSampler, no separate upscaler, no prompt - your Anima checkpoint doesn't even connect to it.
How it works
PiD (NVIDIA's Pixel Diffusion Decoder) is a diffusion model that runs on the latent and outputs pixels directly, skipping the VAE entirely. In other UIs that's painful, because they make you load a gemma text encoder and write a prompt. This node kills both: the distilled 4-step path has no CFG, so the net conditions on a fixed null caption that ships pre-baked with the pack (~1.4 MB, no multi-GB gemma download). Internally it normalizes the Qwen latent - ComfyUI stores raw latents, PiD wants per-channel normalized - runs its own 4-step velocity-prediction schedule, and hands you pixels.
Output size = latent_grid × 8 × 4. A 64×64 latent → 2048×2048; a 128×128 latent (a 1024px Anima generation) → 4096×4096. The res2kto4k in the model name is the trained output range, not the scale - the 4× is baked into the tensor shapes and isn't a knob. Feeding it a 2048px generation would ask for 8192px, outside what the weights were trained on.
Inputs that matter
The node has a lot of knobs, but only a few are ones you'll actually set:
pid_model- theANIMA_PIDsocket from Anima PiD Loader.latent- theLATENTfrom your KSampler. This is the node that replaces VAE Decode, so your workflow's decode gets rerouted here.steps(default 4) - the distilled student's step count; 4 is the sweet spot. More steps shrink the mild per-image color variance (upstream calls it "early-termination whitening") at the cost of speed.sigma(default 0) - how much latent degradation PiD assumes. 0 = clean decode; raise it to let PiD synthesize more fine detail.tile_latent(default 64) - the one that saves you from OOM. 64 → 2048px tiles with feather blending (~7 GB peak in bf16). Set 0 to decode the whole image at once; don't be surprised when 4K OOMs on a ≤16 GB card.tile_overlap(default 16) - overlap in latent units (×32 = pixels). Bigger = fewer seams, slower.compile(default off) - per-blocktorch.compile. Roughly 1.8× faster warm (3.8s → 2.1s per 2048px tile) after a one-time ~37s compilation per output resolution. With tiling on, every tile shares one size, so it compiles once and stays cached - keeptile_latentfixed across runs.use_calib(default off) - leave it off. The bundled color-match transform was fitted against the pre-v1.5 checkpoint's flat/desaturated drift; v1.5 fixes color upstream, so applying it now over-corrects. Only turn it on for a hand-placed v1 checkpoint.attention(default auto) -sage(INT8) is the real speedup if you run SageAttention;autohonors your ComfyUI launch flags;flash≈sdpa.
Plus a seed for the SDE noise. Output: IMAGE → straight into Save Image.
Where it fits
This sits in a different category from the usual upscaling taxonomy. It's not "more pixels" (Lanczos, ESRGAN) and not exactly "more detail" (SeedVR2) - it's the fused middle: a generative decoder that adds detail and pixels in one 4-step pass, at the resolution the Anima model was born at. PiD keeps the latent and replaces only the decoder - the pixel-space compromise most people will actually run. On Anima and want a big final render? This is the one.
Install
Same pack as the loader. ComfyUI Manager: search "Anima PiD", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/sorryhyun/ComfyUI-Anima-PiD
The checkpoint auto-downloads via the loader's (auto-download) entry on first run, and you do not need the Qwen VAE or gemma at decode time. Note the PiD weights are NVIDIA NSCLv1 (non-commercial), so don't ship them in a product.
Troubleshooting
- OOM on 4K output - keep
tile_latentat 64. Setting 0 to "just decode the whole thing" is how people eat 20 GB. - Flat, desaturated colors - on a hand-placed v1 checkpoint that's the known drift: turn
use_calibon. On v1.5, leave it off or you'll over-correct. - First run feels slow - that's
compilewarming up; one-time ~37s per output resolution.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| pid_model | ANIMA_PID | — | |
| latent | LATENT | — | |
| steps | INT | 41–8 | — |
| sigma | FLOAT | 0.000–1 | Latent degradation level PiD assumes. 0.0 = clean decode; higher lets PiD synthesize/hallucinate more detail. |
| seed | INT | 00–18446744073709550000 | — |
| tile_latent | INT | 640–256 | 0 = decode whole image at once (4K output may OOM on <=16GB). >0 = tile the latent (each tile -> tile*32 px) with feather blending. 64 -> 2048px tiles. |
| tile_overlap | INT | 160–64 | Latent-space overlap between tiles (pixels = overlap*32). Larger = fewer seams, slower. |
| compile | BOOLEAN | false | Per-block torch.compile of the PiD net: each transformer block is compiled as its own small graph (faster compile, fewer graph breaks than whole-net — mirrors Anima Block Compile). First run per output size is slow (compilation), then fast; with tiling on all tiles share one size so the blocks compile once. |
| use_calib | BOOLEAN | false | Apply the bundled PiD->native-VAE color-match transform after decode. It was fitted against the pre-v1.5 qwenimage checkpoint, which decoded flat and desaturated vs the native Qwen VAE. v1.5 fixes colour accuracy upstream, so this is OFF by default — applying it on v1.5 would over-correct. Turn on only for a hand-placed v1 checkpoint. |
| attention | COMBO | auto | Attention backend for the PiD net. 'auto' honors ComfyUI's --use-sage-attention / --use-flash-attention launch flags (sage wins), else plain SDPA. 'sdpa' already runs PyTorch's built-in flash kernel here, so 'flash' is ~identical; 'sage' (INT8) is the real speedup. Masked/fp32/CPU paths always fall back to SDPA. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |