HF Diffusers VAE decode
HuggingFace latents back to pixels, with a VAE of your choosing
- latents
- vae
- PIL_IMAGE
The decoder half of the pack's low-level VAE pair, and the mirror image of HFDVAEEncode: give it LATENT and an HFD_AUTOENCODERKL, get a PIL_IMAGE back. That's the whole node - two inputs, one output, no configuration.
You reach for it in the "exploded" workflows the pack ships, where the pipeline runs in latent mode and decoding happens as a separate, explicit step. That separation is the point: it means you can decode with a different VAE than the one the pipeline generated with, or on a different device/dtype than the pipeline itself. In normal (non-exploded) use you never touch it, because HFDRunPipeline in pil mode decodes internally.
How it works
Under the hood it's a textbook diffusers decode: it builds a VaeImageProcessor whose scale factor it derives from the VAE's block_out_channels config (so it adapts to the architecture instead of assuming 8x), divides the latents by the model's scaling_factor, runs vae.decode(), and post-processes the result into a PIL image. Nothing exotic, and that's a good thing - the value here is plumbing, not cleverness.
One detail worth knowing: the input latents are expected to be ComfyUI-format latents, which is what HFDRunPipeline's latent mode and HFDVAEEncode both produce. The node handles the scaling bookkeeping so the latent you made in one place decodes correctly here.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Yahweasel/ComfyUI-HF-Diffusers
or install ComfyUI-HF-Diffusers via ComfyUI Manager, then restart. requirements.txt pins diffusers~=0.36.0.
Gotchas
- Output is PIL again. The
PIL_IMAGEresult needs a PIL-to-IMAGE bridge (Chaoses-Ib'sComfyUI_Ib_CustomNodes) beforeSaveImagewill take it. This pack lives in PIL-land and makes you pay the conversion toll on every image that crosses its borders. - VAE/model mismatch = noise. Decode latents with a VAE from a different architecture and you get static, not a subtly-off image. If you're doing the "decode with a different VAE" trick, make sure it's the same architecture family.
- You probably don't need this node. If a workflow didn't put it there, don't add it. Default
pilmode handles decoding for you.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | — | |
| vae | HFD_AUTOENCODERKL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PIL_IMAGE | PIL_IMAGE | — |