Skip to main content

fastvae

A fast video VAE decoder for consumer Blackwell (sm_120). Decodes at full resolution without tiling, 2.4x faster than the reference Wan VAE decoder in eager PyTorch.

Install

pip install fastvae

Pure Python. The kernels are Triton and compile on first call.

Use

Patch an existing diffusers pipeline:

from fastvae import accelerate_vae

accelerate_vae(pipe)   # pipe.vae.decode now runs through fastvae

Or call the decoder directly:

from fastvae import FastVAEDecoder

dec = FastVAEDecoder.from_vae(vae)
frames = dec.decode(latents)          # (B, 3, T, H, W) in [-1, 1]

For ComfyUI, install fastvae into ComfyUI's Python environment, then register the node:

mkdir -p ComfyUI/custom_nodes/fastvae
echo 'from fastvae.integrations.comfy_node import *' > ComfyUI/custom_nodes/fastvae/__init__.py

This adds FastVAEDecode under latent/video, a drop-in replacement for VAEDecode.

Benchmarks

RTX PRO 6000 Blackwell (sm_120), bf16, Wan 2.1 VAE. Median of 3 runs.

case eager fastvae speedup peak VRAM
480p / 81f 2817 ms 1171 ms 2.41x 6.82 GiB
480p / 161f 5613 ms 2340 ms 2.40x 7.18 GiB
720p / 81f 6570 ms 2782 ms 2.36x 15.21 GiB
720p / 161f 13069 ms 5419 ms 2.41x 16.06 GiB

Every peak fits a 32 GB RTX 5090 without tiling. torch.compile reaches 1.74x on the shortest case, tiled decode is slower than eager, and the Wan 2.2 VAE speedup is 1.7x.

Reproduce with python -m fastvae.bench.harness --vae <pipeline-dir>. Raw output is in benchmarks/.

How it works

Four changes to the reference decoder:

  1. Fused norm and activation. WanRMS_norm plus SiLU is about seven kernels in eager; one Triton kernel does it in a single pass.
  2. Channels-last-3d throughout, which turns the reference's per-upsample layout conversions into free views.
  3. Deferred residual adds and conv biases, absorbed into the next fused norm.
  4. Temporal chunking instead of spatial tiling. Causal conv caching is exact for any chunk length, so chunk size trades peak VRAM for launch count without changing the output.

Ops that only move data are bitwise identical to the reference, asserted in tests. The channel-wise L2 norm is not, since its fp32 reduction order cannot be matched, which diffuses to a max absolute error of 4e-2 on a [-1, 1] output, against 5.2e-2 for torch.compile and 2.0e-1 for tiled decode.

Supported models

AutoencoderKLWan (Wan 2.1 and Wan 2.2). Support is an adapter that rebuilds a reference module tree from fastvae.ops primitives. See fastvae/models/wan.py and register_adapter.

Development

pytest tests/                                    # exactness suite
FASTVAE_TEST_MODEL=<pipeline-dir> pytest tests/  # plus real-checkpoint tests
python -m fastvae.bench.harness --vae <pipeline-dir>
python -m fastvae.bench.m0_profile --model <pipeline-dir>

Metadata

Release files for fastvae 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastvae 0.1.0
File Size Uploaded
fastvae-0.1.0.tar.gz 34.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastvae 0.1.0
File Interpreter ABI Platform
fastvae-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 69.3 kB

Release files / fastvae-0.1.0.tar.gz

Download URL fastvae-0.1.0.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e1d0d1b73397782f0e59ae24c1835441f1b904c5c71103cb7753c93336167b17
BLAKE2b-256 checksum
How to use checksums
37d82ea6cd5b719e0968e9c3aef6c6422e6fc9f3cf2b52921aa11f78dcdfd3ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / fastvae-0.1.0-py3-none-any.whl

Download URL fastvae-0.1.0-py3-none-any.whl
Size 34.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0df1361b72a7050eaa35f1f1b08958c74e02da0790ea60431c69aa25b881e35
BLAKE2b-256 checksum
How to use checksums
cca36d65d1790d028d85fbdb43fb550a1b90c9def56faa7aab26aeade16b88ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page