hunyuan15vae ¶
Classes¶
fastvideo.models.vaes.hunyuan15vae.AutoencoderKLHunyuanVideo15 ¶
Bases: Module, ParallelTiledVAE
A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used for HunyuanVideo-1.5.
This model inherits from [ModelMixin]. Check the superclass documentation for it's generic methods implemented for all models (such as downloading or saving).
Source code in fastvideo/models/vaes/hunyuan15vae.py
Methods:¶
fastvideo.models.vaes.hunyuan15vae.AutoencoderKLHunyuanVideo15.forward ¶
forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: Optional[Generator] = None) -> Tensor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample | `torch.Tensor` | Input sample. | required |
sample_posterior | `bool`, *optional*, defaults to `False` | Whether to sample from the posterior. | False |
return_dict | `bool`, *optional*, defaults to `True` | Whether or not to return a [ | True |
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15AttnBlock ¶
HunyuanVideo15AttnBlock(in_channels: int)
Bases: Module
Source code in fastvideo/models/vaes/hunyuan15vae.py
Methods:¶
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15AttnBlock.prepare_causal_attention_mask staticmethod ¶
Prepare a causal attention mask for 3D videos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_frame | int | Number of frames (temporal length). | required |
n_hw | int | Product of height and width. | required |
dtype | Desired mask dtype. | required | |
device | Device for the mask. | required | |
batch_size | int | If set, expands for batch. | None |
Returns:
| Type | Description |
|---|---|
| torch.Tensor: Causal attention mask. |
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15Decoder3D ¶
HunyuanVideo15Decoder3D(in_channels: int = 32, out_channels: int = 3, block_out_channels: Tuple[int, ...] = (1024, 1024, 512, 256, 128), layers_per_block: int = 2, spatial_compression_ratio: int = 16, temporal_compression_ratio: int = 4, upsample_match_channel: bool = True)
Bases: Module
Causal decoder for 3D video-like data used for HunyuanImage-1.5 Refiner.
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15Downsample ¶
Bases: Module
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15Encoder3D ¶
HunyuanVideo15Encoder3D(in_channels: int = 3, out_channels: int = 64, block_out_channels: Tuple[int, ...] = (128, 256, 512, 1024, 1024), layers_per_block: int = 2, temporal_compression_ratio: int = 4, spatial_compression_ratio: int = 16, downsample_match_channel: bool = True)
Bases: Module
3D vae encoder for HunyuanImageRefiner.
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15RMS_norm ¶
HunyuanVideo15RMS_norm(dim: int, channel_first: bool = True, images: bool = True, bias: bool = False)
Bases: Module
A custom RMS normalization layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim | int | The number of dimensions to normalize over. | required |
channel_first | bool | Whether the input tensor has channels as the first dimension. Default is True. | True |
images | bool | Whether the input represents image data. Default is True. | True |
bias | bool | Whether to include a learnable bias term. Default is False. | False |
Source code in fastvideo/models/vaes/hunyuan15vae.py
fastvideo.models.vaes.hunyuan15vae.HunyuanVideo15Upsample ¶
Bases: Module