Nodes/comfyui-usetaesd/TAESD Encode
ComfyUI Node

TAESD Encode

Turn an image into latents fast, without a full VAE hogging VRAM

By neocrz·Created about a year ago·Updated 10 months ago· 4
TAESD Encode
  • pixels
  • LATENT
taesd_model_nametaesd

Everyone talks about the decode side of TAESD - instant previews - and barely anyone mentions that the encode side exists. TAESD Encode (class EncodeTAESD, from neocrz/comfyui-usetaesd) is the flip of that coin: it pushes an existing image into latent space using a Tiny AutoEncoder instead of the full VAE. That matters more than it sounds, because the encode is exactly where an img2img workflow gets expensive and where low-VRAM cards start swapping to system RAM.

You'd wire this into two kinds of setups. First, quick img2img iteration: Load Image → TAESD Encode → KSampler → a cheap preview decode, letting you test prompts and denoise values on a loop that never touches the full VAE. Second, genuinely memory-constrained machines where a full-VAE encode of a big image is the thing that falls over. The README's own framing - "Load Image → TAESD Encode → KSampler → TAESD Decode → Save Image" - is the canonical workflow, and it's a decent one as long as you remember the quality caveat at the end.

How it works

The node loads a TAESD encoder from ComfyUI/models/vae_approx/, wraps it in ComfyUI's VAE machinery with the correct per-model vae_scale/vae_shift baked in, and calls encode() on your image. Two mechanism details worth knowing:

  • It slices off the alpha channel (pixels[:,:,:,:3]), so RGBA images are encoded as RGB. Fine for almost everything.
  • Models are cached in memory after first load, so the second run of the node is free.

The inputs that matter

  • pixels (IMAGE) - the image to encode, typically from a Load Image node.
  • taesd_model_name - enum: taesd (default), taesdxl, taesd3, taef1.

Match the model name to the checkpoint family you're sampling with, same rule as decode: taesd for SD 1.5, taesdxl for SDXL, taef1 for Flux. The node outputs a single LATENT, which you feed into KSampler's latent input.

Installing it

Install via ComfyUI Manager (search comfyui-usetaesd) or:

cd ComfyUI/custom_nodes
git clone https://github.com/neocrz/comfyui-usetaesd

Then restart ComfyUI. No requirements.txt, no extra Python packages - it runs on ComfyUI core alone. The model files, though, are on you. They go in ComfyUI/models/vae_approx/:

cd ComfyUI/models/vae_approx
wget https://huggingface.co/madebyollin/taesd/resolve/main/taesd_encoder.safetensors
wget https://huggingface.co/madebyollin/taesdxl/resolve/main/taesdxl_encoder.safetensors

Common issues

  • FileNotFoundError on load means the {model}_encoder.safetensors for your pick isn't in vae_approx. Put it there, restart.
  • taesd3 and taef1 are paper options in practice. madebyollin's repos for those two ship only a combined diffusion_pytorch_model.safetensors, not the split taesd3_encoder.safetensors / taef1_encoder.safetensors this pack looks for. So they'll error with stock downloads; taesd and taesdxl work out of the box.
  • The latent you get is an approximation. TAESD's latent space is close to, not identical to, the full VAE's. That's the speed/quality trade you accepted. For anything destined to be final output, encode with the real VAE - this is the fast-preview path, and if you're going to render anyway, you're adding a lossy round trip you didn't need. If your encoded image looks subtly off at KSampler's output, that's the approximation talking, and it's expected.

Single-file MIT pack, no dependencies, does exactly what it says. It pairs naturally with its sibling TAESD Decode for full low-VRAM round trips.

Categorylatent/TAESD

Inputs (2)

NameTypeDefaultDescription
pixelsIMAGE
taesd_model_nameCOMBOtaesd4 options: taesd, taesdxl, taesd3, taef1

Outputs (1)

NameTypeDescription
LATENTLATENT