Buckets:

hf-doc-build/doc / diffusers /v0.43.0 /zh /api /models /autoencoder_kl_kvae_video.md
mishig's picture
|
download
raw
4.36 kB

AutoencoderKLKVAEVideo

带有 KL 损失的 3D 变分自编码器(VAE)模型。

可以使用以下代码片段加载该模型。

import torch
from diffusers import AutoencoderKLKVAEVideo

vae = AutoencoderKLKVAEVideo.from_pretrained("kandinskylab/KVAE-3D-1.0", subfolder="diffusers", dtype=torch.float16)

AutoencoderKLKVAEVideo[[diffusers.AutoencoderKLKVAEVideo]]

diffusers.AutoencoderKLKVAEVideo[[diffusers.AutoencoderKLKVAEVideo]]

diffusers.AutoencoderKLKVAEVideo(ch: int = 128, ch_mult: typing.Tuple[int, ...] = (1, 2, 4, 8), num_res_blocks: int = 2, in_channels: int = 3, out_ch: int = 3, z_channels: int = 16, temporal_compress_times: int = 4)

源代码

参数:

ch (int,可选,默认为 128):基础通道数。

ch_mult (Tuple[int],可选,默认为 (1, 2, 4, 8)):每个层级的通道乘数。

num_res_blocks (int,可选,默认为 2):每个层级的残差块数量。

in_channels (int,可选,默认为 3):输入通道数。

out_ch (int,可选,默认为 3):输出通道数。

z_channels (int,可选,默认为 16):潜在通道的数量。

temporal_compress_times (int,可选,默认为 4):时间压缩因子。

一个用于将视频编码为潜在表示并将潜在表示解码为视频的 VAE 模型,包含 KL 损失。用于 KVAE。

该模型继承自 ModelMixin。有关为所有模型实现的通用方法(例如下载或保存),请查阅其父类文档。

decode[[diffusers.AutoencoderKLKVAEVideo.decode]]

decode(z: Tensor, return_dict: bool = True)

源代码

参数:

z (torch.Tensor) : 输入批次的潜在向量,形状为 (B, C, T, H, W)。

return_dict (bool,可选,默认为 True):是否返回 ~models.vae.DecoderOutput 而不是普通元组。

返回: ~models.vae.DecoderOutput 或 tuple

解码后的视频。

解码一批视频。

disable_slicing[[diffusers.AutoencoderKLKVAEVideo.disable_slicing]]

disable_slicing()

源代码

禁用切片 VAE 解码。

enable_slicing[[diffusers.AutoencoderKLKVAEVideo.enable_slicing]]

enable_slicing()

源代码

启用切片 VAE 解码。

encode[[diffusers.AutoencoderKLKVAEVideo.encode]]

encode(x: Tensor, return_dict: bool = True)

源代码

参数:

x (torch.Tensor) : 输入的视频批次,形状为 (B, C, T, H, W)。

return_dict (bool,可选,默认为 True):是否返回 ~models.autoencoder_kl.AutoencoderKLOutput 而不是普通元组。

返回值:

编码视频的潜在表示。

将一批视频编码为潜在表示。

forward[[diffusers.AutoencoderKLKVAEVideo.forward]]

forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None)

源代码

参数:

sample (torch.Tensor) : 输入样本。

sample_posterior (bool,可选,默认为 False):是否从后验分布中采样。

return_dict (bool,可选,默认为 True):是否返回 DecoderOutput 而不是普通元组。

generator (torch.Generator,可选):一个 torch.Generator,用于使采样过程具有确定性。

返回: ~models.vae.DecoderOutput 或 tuple

如果 return_dict 为 True,则返回 ~models.vae.DecoderOutput,否则返回普通的 tuple。

Xet Storage Details

Size:
4.36 kB
·
Xet hash:
eb8f3a27734ecb46e21d53b25f75c72a20162f929ce2f5f3eac00eed342935e7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.