minimax_h3_video ¶
Native MiniMax-H3 video VAE.
The encoder is a causal 3D CNN while the decoder is a full-attention ViT. This module intentionally uses only PyTorch and FastVideo configuration types.
Classes¶
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3 ¶
AutoencoderKLMiniMaxH3(config: MiniMaxH3VideoVAEConfig)
Bases: Module
MiniMax-H3 causal encoder and ViT decoder with exact release geometry.
Source code in fastvideo/models/vaes/minimax_h3_video.py
Methods:¶
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3.decode_to_pixels ¶
Stream decoded [0, 1] FP32 pixels into a caller-owned CPU buffer.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3.decoded_pixel_shape ¶
Return the exact CPU pixel-buffer shape for a latent tensor shape.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3.encode_keyframe ¶
encode_keyframe(x: Tensor, return_dict: bool = True) -> AutoencoderKLOutput | tuple[DiagonalGaussianDistribution]
Encode one-frame conditioning inputs without video chunk padding.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3.encode_pixels ¶
encode_pixels(pixels: Tensor, return_dict: bool = True) -> AutoencoderKLOutput | tuple[DiagonalGaussianDistribution]
Encode CPU-resident pixels one VAE clip at a time.
pixels stays on CPU as uint8 in [0, 255] or floating point in [0, 1]; each clip is moved to the VAE device, normalized, and encoded so only one clip of pixels is resident on the accelerator.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.AutoencoderKLMiniMaxH3.prepare_for_compile ¶
Compile the fixed-shape tile helpers for the opt-in VAE compile path.
ComposedPipelineBase._maybe_compile_pipeline_module calls this hook only when enable_torch_compile_vae is set, right before the decoder is compiled through _compile_conditions. The spatial tile grid and the per-tile decoder-input projection have fixed shapes, so mode="reduce-overhead" records one CUDA graph per geometry and replays it for every tile and temporal chunk. Keeping this behind the opt-in means default (eager) users pay neither the inductor/triton toolchain requirement and first-decode compile latency nor the permanent cudagraph memory pools, and multi-resolution callers never churn dynamic=False recompiles they did not ask for.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.DiagonalGaussianDistribution ¶
DiagonalGaussianDistribution(parameters: Tensor, deterministic: bool = False)
Diagonal Gaussian posterior used by the KL encoder.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoAttention ¶
Bases: Module
Build projections and the selected dense FastVideo attention implementation.
Source code in fastvideo/models/vaes/minimax_h3_video.py
Methods:¶
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoAttention.forward ¶
forward(hidden_states: Tensor, rotary_emb: tuple[Tensor, Tensor] | None = None) -> Tensor
Apply dense self-attention to one spatial VAE token sequence.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoCausalConv3d ¶
MiniMaxH3VideoCausalConv3d(in_channels: int, out_channels: int, kernel_size: int | tuple[int, int, int], stride: int | tuple[int, int, int] = 1, spatial_padding: int = 0, temporal_padding: int = 0, spatial_padding_mode: str = 'reflect')
Bases: Conv3d
3D convolution with reflect spatial padding and causal temporal padding.
Source code in fastvideo/models/vaes/minimax_h3_video.py
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoGroupNorm ¶
Bases: GroupNorm
GroupNorm with each temporal frame normalized independently.
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoViTDecoder3d ¶
MiniMaxH3VideoViTDecoder3d(in_channels: int, out_channels: int, patch_size: int, patch_size_t: int, num_layers: int, num_attention_heads: int, attention_head_dim: int, num_register_tokens: int, ffn_mult: int, rope_theta: float, rope_dim_ratio: float, norm_eps: float)
Bases: Module
Source code in fastvideo/models/vaes/minimax_h3_video.py
Methods:¶
fastvideo.models.vaes.minimax_h3_video.MiniMaxH3VideoViTDecoder3d.forward ¶
Decode one latent spatial input through the H3 video transformer.