The video variational autoencoder (VAE) model with KL loss used in MiniMax-H3 by MiniMax. It pairs a causal 3D CNN encoder with a non-causal ViT decoder and compresses 16x…
AutoencoderKLMiniMaxH3
The video variational autoencoder (VAE) model with KL loss used in MiniMax-H3 by MiniMax. It pairs a causal 3D CNN encoder with a non-causal ViT decoder and compresses 16x spatially and 4x temporally.
Three things set it apart from most autoencoders in the library:
- Latents are normalized per channel. There is no
scaling_factor: a pipeline encodes with(latent - latents_mean) / latents_stdand decodes withlatent * latents_std + latents_mean. - The pixel convention is ImageNet-normalized RGB over a
[0, 1]base range, not the usual[-1, 1].encodeexpects(pixel - imagenet_mean) / imagenet_stdanddecodereturns values in that same space, so a pipeline appliessample * imagenet_std + imagenet_meanand clamps to[0, 1]before postprocessing. - Spatial tiling is on by default. MiniMax-H3 was released with tiling enabled for both encoding and decoding and the released frames are the blended-tile ones, so turning it off changes the output. Use
enable_tilingto change the tile geometry anddisable_tilingto switch it off.
The temporal geometry is fixed by clip_length (17 pixel frames per encoder chunk) and token_drop (3 trailing latent frames dropped per encode), so 17 * n + 5 pixel frames map to 5 * n + 2 latent frames.
import torch
from diffusers import AutoencoderKLMiniMaxH3
vae = AutoencoderKLMiniMaxH3.from_pretrained(
"MiniMaxAI/MiniMax-H3", subfolder="vae", dtype=torch.float32
).to("cuda") # or "mps", "xpu", "cpu"
AutoencoderKLMiniMaxH3
[[autodoc]] AutoencoderKLMiniMaxH3 - encode - decode - all
Source and license
Source: Diffusers documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.