Ir al contenido
Invoke

Wan VAE Memory Calibration

Esta página aún no está disponible en tu idioma.

Before a Wan VAE decode, Invoke estimates the working memory it needs and asks the model cache to keep that much VRAM free (see Low-VRAM mode). The estimate scales with the video’s size through a constant shipped in the code. scripts/calibrate_wan_vae_working_memory.py measures a real decode so you can check that constant on your own GPU.

It needs a CUDA or ROCm device and a Wan VAE, as a Diffusers AutoencoderKLWan directory or a .safetensors checkpoint:

Terminal window
python scripts/calibrate_wan_vae_working_memory.py --vae <directory-or-safetensors-file>
OptionDefaultMeasures
--vaerequiredThe VAE to load.
--height, --width, --frames704, 1280, 81The video’s size in pixels and frames.
--dtypefloat16The VAE’s dtype.
--streaming / --no-streamingstreamingThe chunked decode that wan_memory_optimization streams to MP4, or the default full decode.
--tilingoffThe spatially tiled full decode, the fallback for decodes too large for the card. Overrides --streaming.
--tile-size <pixels>the VAE’s tile sizeThe tile size. Requires --tiling.

The script prints the estimate, the measured allocated and reserved memory deltas, the scaling constant the reserved delta implies, and estimate covers: <ratio>x of reserved.

  • The implied constant uses reserved memory, which is what the shipped estimator covers: reserved memory is what the decode takes from the GPU.
  • The shipped constant sits above what the script reports for most sizes, because it has to cover the highest measurement, an 832x480 decode inside a running server. estimate covers says whether the estimate holds: 1.00x or more means it does.
  • With --tiling the copies of each clip can exceed the whole measurement and leave a negative implied constant; read estimate covers instead.

Streaming to MP4 keeps the VAE cache lock while chunks are decoded and written. Wan’s causal decoder state and weights must stay live for the whole sequence; releasing the lock between chunks would need a separate, bounded decode and encode queue.