Diffusers documentation
AutoencoderKLLTX2Audio
AutoencoderKLLTX2Audio
Mô hình autoencoder biến phân 3D (VAE) với tổn thất KL được sử dụng trong LTX-2 do Lightricks giới thiệu. Mô hình này dùng để mã hóa và giải mã các biểu diễn ẩn của âm thanh.
Mô hình có thể được tải bằng đoạn mã sau.
from diffusers import AutoencoderKLLTX2Audio
vae = AutoencoderKLLTX2Audio.from_pretrained("Lightricks/LTX-2", subfolder="vae", dtype=torch.float32).to("cuda") # or "mps", "xpu", "cpu"AutoencoderKLLTX2Audio
lớp diffusers.AutoencoderKLLTX2Audio
< source >( 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 audio VAE để mã hóa và giải mã các biểu diễn ẩn của âm thanh.
forward
< source >( sample: Tensorsample_posterior: bool = Falsereturn_dict: bool = Truegenerator: typing.Optional[torch.Generator] = None ) → DecoderOutput or tuple
Tham số
- sample (
torch.Tensor) — Mẫu đầu vào. - sample_posterior (
bool, tùy chọn, mặc định làFalse) — Có lấy mẫu từ posterior hay không. - return_dict (
bool, tùy chọn, mặc định làTrue) — Có nên trả về mộtDecoderOutputthay vì một tuple thông thường hay không. - generator (
torch.Generator, tùy chọn) — Mộttorch.Generatorđể làm cho việc lấy mẫu trở nên tất định.
Trả về
DecoderOutput hoặc tuple
Nếu return_dict là True, một DecoderOutput sẽ được trả về, ngược lại một tuple thông thường sẽ được trả về.