Buckets:

hf-doc-build/doc / diffusers /main /ko /api /models /autoencoderkl_ltx_video.md
mishig's picture
|
download
raw
10.9 kB

AutoencoderKLLTXVideo

LTX에서 사용된 KL 손실을 갖춘 3D 변분 오토인코더(VAE) 모델은 Lightricks에 의해 소개되었습니다.

다음 코드 스니펫으로 모델을 로드할 수 있습니다.

from diffusers import AutoencoderKLLTXVideo

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

AutoencoderKLLTXVideo[[diffusers.AutoencoderKLLTXVideo]]

diffusers.AutoencoderKLLTXVideo[[diffusers.AutoencoderKLLTXVideo]]

diffusers.AutoencoderKLLTXVideo(in_channels: int = 3, out_channels: int = 3, latent_channels: int = 128, block_out_channels: tuple = (128, 256, 512, 512), down_block_types: tuple = ('LTXVideoDownBlock3D', 'LTXVideoDownBlock3D', 'LTXVideoDownBlock3D', 'LTXVideoDownBlock3D'), decoder_block_out_channels: tuple = (128, 256, 512, 512), layers_per_block: tuple = (4, 3, 3, 3, 4), decoder_layers_per_block: tuple = (4, 3, 3, 3, 4), spatio_temporal_scaling: tuple = (True, True, True, False), decoder_spatio_temporal_scaling: tuple = (True, True, True, False), decoder_inject_noise: tuple = (False, False, False, False, False), downsample_type: tuple = ('conv', 'conv', 'conv', 'conv'), upsample_residual: tuple = (False, False, False, False), upsample_factor: tuple = (1, 1, 1, 1), timestep_conditioning: bool = False, patch_size: int = 4, patch_size_t: int = 1, resnet_norm_eps: float = 1e-06, scaling_factor: float = 1.0, encoder_causal: bool = True, decoder_causal: bool = False, spatial_compression_ratio: int = None, temporal_compression_ratio: int = None)

소스

매개변수:

in_channels (int, 기본값 3) : 입력 채널 수.

out_channels (int, 기본값 3) : 출력 채널 수.

latent_channels (int, 기본값 128) : 잠재 채널의 수.

block_out_channels (tuple[int, ...], 기본값 (128, 256, 512, 512)) : 각 블록의 출력 채널 수입니다.

spatio_temporal_scaling (tuple[bool, ...], defaults to (True, True, True, False)` : Whether a block should contain spatio-temporal downscaling or not.

layers_per_block (tuple[int, ...], 기본값 (4, 3, 3, 3, 4)) : 블록당 레이어 수.

patch_size (int, 기본값 4) : 공간 패치의 크기입니다.

patch_size_t (int, 기본값 1) : 시간 패치의 크기입니다.

resnet_norm_eps (float, 기본값 1e-6) : ResNet 정규화 레이어에 사용되는 Epsilon 값.

scaling_factor (float, 선택 사항, 기본값 1.0) : 학습 세트의 첫 번째 배치로 계산된 학습된 잠재 공간의 요소별 표준 편차입니다. 이는 diffusion model을 학습할 때 잠재 공간의 분산을 1로 스케일링하는 데 사용됩니다. Latents는 diffusion model에 전달되기 전에 z = z * scaling_factor 공식으로 스케일링됩니다. 디코딩 시에는 z = 1 / scaling_factor * z 공식으로 원래 스케일로 되돌립니다. 자세한 내용은 High-Resolution Image Synthesis with Latent Diffusion Models 논문의 4.3.2절과 D.1절을 참조하세요.

encoder_causal (bool, 기본값 True) : 인코더가 인과적으로 동작할지(미래 프레임이 과거 프레임에만 의존) 여부를 지정합니다.

decoder_causal (bool, 기본값 False) : 디코더가 인과적으로 동작할지(미래 프레임이 과거 프레임에만 의존) 여부를 결정합니다.

KL 손실을 사용하여 이미지를 잠재 변수로 인코딩하고 잠재 표현을 이미지로 디코딩하는 VAE 모델입니다. LTX에서 사용됩니다.

이 모델은 ModelMixin에서 상속됩니다. 모든 모델에 대해 구현된 일반적 메서드(다운로드 또는 저장 등)에 대해서는 상위 클래스 문서를 확인하세요.

decode[[diffusers.AutoencoderKLLTXVideo.decode]]

decode(z: Tensor, temb: typing.Optional[torch.Tensor] = None, return_dict: bool = True)

소스

매개변수:

z (torch.Tensor) : 잠재 벡터의 입력 배치.

return_dict (bool, 선택 사항, 기본값 True) : 일반 튜플 대신 ~models.vae.DecoderOutput를 반환할지 여부.

반환값: ~models.vae.DecoderOutput 또는 tuple

return_dict가 True이면 ~models.vae.DecoderOutput가 반환되고, 그렇지 않으면 일반 tuple이 반환됩니다.

이미지 배치(decode)를 디코딩합니다.

encode[[diffusers.AutoencoderKLLTXVideo.encode]]

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

소스

매개변수:

x (torch.Tensor) : 입력 이미지 배치.

return_dict (bool, 선택 사항, 기본값 True) : 일반 튜플 대신 ~models.autoencoder_kl.AutoencoderKLOutput을 반환할지 여부.

반환값:

인코딩된 비디오의 잠재 표현입니다. return_dict가 True이면 ~models.autoencoder_kl.AutoencoderKLOutput이 반환되고, 그렇지 않으면 일반 tuple이 반환됩니다.

이미지 배치(latents)를 인코딩합니다.

enable_tiling[[diffusers.AutoencoderKLLTXVideo.enable_tiling]]

enable_tiling(tile_sample_min_height: int | None = None, tile_sample_min_width: int | None = None, tile_sample_min_num_frames: int | None = None, tile_sample_stride_height: float | None = None, tile_sample_stride_width: float | None = None, tile_sample_stride_num_frames: float | None = None)

소스

매개변수:

tile_sample_min_height (int, 선택 사항) : 샘플이 높이 차원으로 타일링되어 분리되려면 필요한 최소 높이입니다.

tile_sample_min_width (int, 선택 사항) : 샘플이 너비 차원으로 타일 분리되도록 요구되는 최소 너비입니다.

tile_sample_stride_height (int, 선택 사항) : 두 개의 연속된 세로 타일 사이의 최소 겹침 양입니다. 이는 높이 차원에서 타일링 아티팩트가 발생하지 않도록 보장하기 위한 것입니다.

tile_sample_stride_width (int, 선택 사항) : 두 인접한 수평 타일 사이의 스트라이드입니다. 이는 너비 차원에서 타일링 아티팩트가 발생하지 않도록 보장하기 위한 것입니다.

타일 VAE 디코딩을 활성화합니다. 이 옵션이 활성화되면 VAE는 입력 텐서를 타일로 분할하여 디코딩 및 인코딩을 여러 단계로 계산합니다. 이는 대량의 메모리를 절약하고 더 큰 이미지를 처리할 수 있도록 하는 데 유용합니다.

forward[[diffusers.AutoencoderKLLTXVideo.forward]]

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

소스

매개변수:

sample (torch.Tensor) : 입력 샘플.

temb (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이 반환됩니다.

tiled_decode[[diffusers.AutoencoderKLLTXVideo.tiled_decode]]

tiled_decode(z: Tensor, temb: typing.Optional[torch.Tensor], return_dict: bool = True)

소스

매개변수:

z (torch.Tensor) : 잠재 벡터의 입력 배치.

return_dict (bool, 선택 사항, 기본값 True) : 일반 튜플 대신 ~models.vae.DecoderOutput를 반환할지 여부.

반환값: ~models.vae.DecoderOutput 또는 tuple

return_dict가 True이면 ~models.vae.DecoderOutput가 반환되고, 그렇지 않으면 일반 tuple이 반환됩니다.

tiled decoder를 사용하여 이미지 배치(decoding)를 디코딩합니다.

tiled_encode[[diffusers.AutoencoderKLLTXVideo.tiled_encode]]

tiled_encode(x: Tensor)

소스

매개변수:

x (torch.Tensor) : 입력 비디오 배치.

반환값: torch.Tensor

인코딩된 비디오의 잠재 표현(latent representation).

타일 인코더를 사용하여 이미지 배치 인코딩

AutoencoderKLOutput[[diffusers.models.modeling_outputs.AutoencoderKLOutput]]

diffusers.models.modeling_outputs.AutoencoderKLOutput[[diffusers.models.modeling_outputs.AutoencoderKLOutput]]

diffusers.models.modeling_outputs.AutoencoderKLOutput(latent_dist: DiagonalGaussianDistribution)

소스

매개변수:

latent_dist (DiagonalGaussianDistribution) : Encoder의 인코딩된 출력으로, DiagonalGaussianDistribution의 평균(mean)과 logvar로 표현됩니다. DiagonalGaussianDistribution을 사용하면 해당 분포에서 latents를 샘플링할 수 있습니다.

AutoencoderKL 인코딩 메서드의 출력.

DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]

diffusers.models.autoencoders.vae.DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]

diffusers.models.autoencoders.vae.DecoderOutput(sample: Tensor, commit_loss: typing.Optional[torch.FloatTensor] = None)

소스

매개변수:

sample (torch.Tensor, shape (batch_size, num_channels, height, width)) : 모델의 마지막 레이어에서 디코딩된 출력 샘플.

디코딩 메서드의 출력.

Xet Storage Details

Size:
10.9 kB
·
Xet hash:
82f6970ae9c983c3b5f3cbdebbfa2449906936d873bbebb8ff6b572a5df1ddc4

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