Nodes/ComfyUI_DyPE/DyPE_Encoder
ComfyUI Node

DyPE_Encoder

The one-node VAE decoder Flux 2 Klein insists on

By smthemex·Created 10 months ago·Updated 6 months ago· 32
DyPE_Encoder
  • latent
  • image
vae

DyPE_Encoder exists because of a formatting disagreement between Flux 2 Klein and everyone else, and it's the node that resolves it. Feed it the LATENT that DyPE_KSampler produced plus a VAE file, and it returns an IMAGE. In a pack of four nodes, this is the one that quietly does real work - it's not a passthrough and it's not a convenience wrapper; it's a purpose-built decoder.

Here's the mess it's cleaning up. Klein's latents aren't in the layout ComfyUI's native VAEDecode expects. They're patchified (chunked and permuted into a packed shape), and on top of that the Flux 2 VAE normalizes its latents with batch-norm statistics before the transformer sees them. If you tried to decode the raw output with a stock decoder you'd get noise, or worse, a plausible-looking mess. So DyPE_Encoder does the reverse dance: it re-applies the batch-norm mean/scale the pipeline baked in, un-patchifies the latents back into a proper [B, C, H, W] tensor, runs them through a Flux 2 VAE (AutoencoderKLFlux2) with tiling enabled so it doesn't explode on big resolutions, and hands you a clean IMAGE tensor.

That's why the README calls out a very specific file requirement: the VAE you point at here must be the diffusers-format flux2_4b.safetensors, not the ComfyUI-converted one. The two are not interchangeable, and "wrong VAE" is the classic first-run failure for this node - it decodes, it's just garbage. Klein also wants diffusers 0.37+.

The inputs that matter

  • latent (LATENT) - the output of DyPE_KSampler. This is the only source; it's what carries the patchified, normalized latents.
  • vae - a dropdown of everything in ComfyUI/models/vae. For this node specifically, the flux2_4b.safetensors diffusers-format file. Tiling is always on, which is what lets a consumer card chew through a 4K latent without running out of memory mid-decode.

One output, image (IMAGE), straight into SaveImage (or an upscaler, if you're still going bigger).

Wiring it into the graph

In the pack's example workflow the Klein path is: DyPE_Model → DyPE_Condition → DyPE_KSampler → DyPE_Encoder → SaveImage, with the VAE loaded from disk. The non-Klein models (Flux 1 Krea, Qwen, Z-Image) skip this node entirely and decode with the native VAEDecode or VAEDecodeTiled. If you see a workflow using DyPE_Encoder, you're looking at a Klein workflow, and the VAE in the example graph will be the diffusers-format one.

Installing

Pack-wide: ComfyUI Manager (search "ComfyUI_DyPE"), or

cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_DyPE
pip install -r requirements.txt

Deps: diffusers, transformers, accelerate, sentencepiece, opencv-python, omegaconf; diffusers 0.37+ for Klein.

Where people get burned

  • Wrong VAE format. You loaded a VAE, it decoded, and the image looks like static or melted paint - you grabbed the ComfyUI-converted flux2_4b.safetensors. Get the diffusers one.
  • Forgetting it's Klein-only. Wire it into a Flux 1 Krea workflow and it'll happily try - the node doesn't check - and produce nonsense, because the Flux 2 VAE config it loads is hardcoded to the Klein 4B architecture.
  • It's a decode step, not a denoise step. If your high-res image has coherence problems - extra fingers, doubled limbs - the fix is upstream in DyPE_KSampler's resolution or steps, not here. At true 4K those artifacts are the model's fault, and this node just faithfully exposes them.

Simplest honest summary: if your DyPE workflow is Klein, this is your SaveImage feed; if it isn't, pretend this node doesn't exist.

CategoryDyPE

Inputs (2)

NameTypeDefaultDescription
latentLATENT
vaeCOMBO1 options: none

Outputs (1)

NameTypeDescription
imageIMAGE