Files
ComfyUI_frontend/apps/hub/knowledge/concepts/vae.md
dante01yoon bbd0a6b201 feat: migrate workflow template site as apps/hub
Migrate workflow_templates/site into the frontend monorepo as apps/hub
so the hub can use @comfyorg/design-system and shared packages.

Changes to existing files:
- pnpm-workspace.yaml: add @astrojs/sitemap, @astrojs/vercel, lucide-vue-next
- eslint.config.ts: add hub ignores and i18n/import rule overrides
- .oxlintrc.json: add hub scripts to ignore patterns
- knip.config.ts: add hub workspace config

apps/hub adaptations from source:
- Replace local cn() with @comfyorg/tailwind-utils (19 files)
- Integrate @comfyorg/design-system/css/base.css in global.css
- Make TEMPLATES_DIR configurable via HUB_TEMPLATES_DIR env var
- Add HUB_SKIP_SYNC flag for builds without template data
- Remove Vite 8-incompatible rollupOptions.output.manualChunks
- Fix stylelint violations (modern color notation, number precision)
- Gitignore generated content (thumbnails, synced templates, AI cache)
2026-04-06 20:53:13 +09:00

1.6 KiB

VAE (Variational Autoencoder)

The VAE encodes pixel images into a compact latent representation and decodes latents back into pixel images. All diffusion in Stable Diffusion and Flux happens in latent space — the VAE is the bridge between the images you see and the mathematical space where the model actually works. Every generation workflow ends with a VAE decode step to produce a viewable image.

How It Works in ComfyUI

  • Key nodes: VAEDecode (latent → image), VAEEncode (image → latent), VAEDecodeTiled (for large images to avoid out-of-memory errors), VAELoader (load a standalone VAE file)
  • Typical workflow pattern: Most checkpoints include a built-in VAE, so the VAEDecode node can pull directly from the loaded checkpoint. To use a different VAE, add a VAELoader node and connect it to VAEDecode instead.

Key Settings

  • tile_size (for VAEDecodeTiled): Size of each tile when decoding in chunks. Default is 512; reduce if you still encounter memory issues
  • VAE choice: VAE files are model-specific. Use sdxl_vae.safetensors for SDXL, ae.safetensors for Flux. Place files in ComfyUI/models/vae/

Tips

  • If colors look washed out or slightly off, try loading an external VAE — the VAE baked into a checkpoint is not always optimal, especially for community fine-tunes
  • Use VAEDecodeTiled for images larger than ~2048 px on either side to prevent out-of-memory crashes
  • SDXL and Flux each have their own VAE architecture — using the wrong one will produce corrupted output
  • When doing img2img or inpainting, the VAEEncode node converts your input image into the latent space the model expects