Diffusers documentation

AutoencoderKLLTX2Audio

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

AutoencoderKLLTX2Audio

LTX-2 中使用的带 KL 损失的 3D 变分自编码器(VAE)模型由 Lightricks 提出。该模型用于音频潜在表示的编码和解码。

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

from diffusers import AutoencoderKLLTX2Audio

vae = AutoencoderKLLTX2Audio.from_pretrained("Lightricks/LTX-2", subfolder="vae", dtype=torch.float32).to("cuda")  # or "mps", "xpu", "cpu"

AutoencoderKLLTX2Audio

类 diffusers.AutoencoderKLLTX2Audio

< >

( base_channels: int = 128output_channels: int = 2ch_mult: tuple = (1, 2, 4)num_res_blocks: int = 2attn_resolutions: tuple[int, ...] | None = Nonein_channels: int = 2resolution: int = 256latent_channels: int = 8norm_type: str = 'pixel'causality_axis: str | None = 'height'dropout: float = 0.0mid_block_add_attention: bool = Falsesample_rate: int = 16000mel_hop_length: int = 160is_causal: bool = Truemel_bins: int | None = 64double_z: bool = True )

LTX2 音频 VAE,用于编码和解码音频潜在表示。

encode

< >

( x: Tensorreturn_dict: bool = True )

decode

< >

( z: Tensorreturn_dict: bool = True )

forward

< >

( sample: Tensorsample_posterior: bool = Falsereturn_dict: bool = Truegenerator: typing.Optional[torch.Generator] = None ) → DecoderOutput or tuple

参数

  • sample (torch.Tensor) — 输入样本。
  • sample_posterior (bool,可选,默认为 False) — 是否从后验分布中采样。
  • return_dict (bool,可选,默认为 True) — 是否返回 DecoderOutput 而不是普通元组。
  • generator (torch.Generator,可选) — 用于使采样过程确定性的 torch.Generator。

返回值

DecoderOutput 或 tuple

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

Update on GitHub