Nodes/TinySanaPreview/TinySanaPreview
ComfyUI Node

TinySanaPreview

Sana finally gets live previews — without paying for the slow DC-AE decode

By cake-ml·Created 2 years ago·Updated 2 years ago· 2
TinySanaPreview
  • model
  • patched_model
previewer_model
dtypebf16

If you've run a Sana model in ComfyUI you know the drill: the image generator is fast, and the preview is... not. That's because Sana doesn't use a normal VAE. It uses a DC-AE (deep compression autoencoder) that squashes images 32x instead of the usual 8x, and that thing is slow to decode - on an RTX A4000, one 1,32,32,32 latent takes about 389ms to turn into a picture. That's most of your generation time spent babysitting a progress bar. TinySanaPreview fixes exactly that: a 9.6M-parameter "TinySanaDecoder" (TSD) that decodes at 8x compression in about 8ms - a ~46x speedup - and shows you real-time previews while Sana samples.

What it actually is

It's a one-node pack from cake-ml, category latent, and the name tells you the job: real-time previews for Sana models. Think of it as the Sana equivalent of TAESD - the little approximate decoder you drop in when the real VAE decode is too expensive to run every sampling step. The tradeoff is baked in: because TSD compresses 8x instead of 32x, preview images come out at a quarter of the width/height the DC-AE would produce. They're rough and small, but that's the point. They're for watching your image form, not for final output. You still run the real VAE at the end of the workflow.

How the trick works

The node is sneaky in a good way. Wire it anywhere before your sampler and it clones the model, then attaches a few flags to the clone. Under the hood it patches ComfyUI's own latent_preview.prepare_callback, so when the KSampler runs, every step decodes the current x0 with the tiny decoder and pumps a JPEG into the progress bar preview. The decoder itself is a plain PixelShuffle CNN - a couple dozen conv layers, no attention, nothing exotic - which is exactly why it's so cheap. You pick the tsd.safetensors file and a dtype, and it loads lazily on first use.

The three inputs (and the one output)

Only three inputs, and only two you'll touch:

  • model - your Sana MODEL object, straight from the checkpoint/Unet loader.
  • previewer_model - a dropdown of whatever's in your models/vae_approx folder. Pick tsd.safetensors.
  • dtype - bf16 by default and the right call on anything Ampere-or-newer. Older GPUs without bf16 support should drop to fp16 or fp32.

Output is a single patched_model (MODEL, tooltip: "The patched model."). Run that into your KSampler instead of the original and you're done. The layout is dead simple: Load Checkpoint → TinySanaPreview → KSampler.

Installing it

Either route works. If you use ComfyUI Manager, search for "TinySanaPreview" and install it. Otherwise:

cd ComfyUI/custom_nodes
git clone https://github.com/cake-ml/tiny-sana-preview

Then grab the decoder - this step is mandatory, and the part people skip:

# from ComfyUI's models directory
wget -O models/vae_approx/tsd.safetensors \
  https://huggingface.co/cake-ml/tsd/resolve/main/tsd.safetensors

Restart ComfyUI. There's no requirements.txt - it's pure PyTorch built on ComfyUI's existing latent_preview and safetensors machinery, so no dependency rabbit hole. Total footprint is a ~9.6M model, which is nothing on VRAM.

Where people get burned

The classic failure: no preview at all, because tsd.safetensors isn't in models/vae_approx. The dropdown only lists files that are already there, so if it's empty, that's why. Second: a bf16 crash on pre-Ampere cards - switch to fp16 or fp32. Third: wiring the output into a second sampler or into the VAE decode path, which does nothing. This node only changes what the preview shows; the actual image you save is untouched. And don't use it with non-Sana models - TSD was trained on Sana latents, so for anything else the previews will look wrong and you'll blame the wrong tool. Sana gets live previews at last; you just need to remember the tiny file that makes them happen.

Categorylatent

Inputs (3)

NameTypeDefaultDescription
modelMODEL
previewer_modelCOMBO0 options:
dtypeCOMBObf163 options: bf16, fp32, fp16

Outputs (1)

NameTypeDescription
patched_modelMODELThe patched model.