Diffusers documentation
AutoencoderKLQwenImage
AutoencoderKLQwenImage
다음 코드 스니펫으로 모델을 로드할 수 있습니다.
from diffusers import AutoencoderKLQwenImage
vae = AutoencoderKLQwenImage.from_pretrained("Qwen/QwenImage-20B", subfolder="vae")AutoencoderKLQwenImage
클래스 diffusers.AutoencoderKLQwenImage
< source >( base_dim: int = 96z_dim: int = 16dim_mult: list = [1, 2, 4, 4]num_res_blocks: int = 2attn_scales: list = []temperal_downsample: list = [False, True, True]dropout: float = 0.0input_channels: int = 3latents_mean: list = [-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921]latents_std: list = [2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916] )
KL 손실을 사용하여 비디오를 잠재 변수로 인코딩하고 잠재 표현을 비디오로 디코딩하는 VAE 모델.
이 모델은 ModelMixin에서 상속됩니다. 모든 모델에 대해 구현된 일반적 메서드(다운로드 또는 저장 등)에 대해서는 상위 클래스 문서를 확인하세요.
decode
< source >( z: Tensorreturn_dict: bool = True ) → ~models.vae.DecoderOutput or tuple
이미지 배치(decode)를 디코딩합니다.
encode
< source >( x: Tensorreturn_dict: bool = True )
이미지 배치(latents)를 인코딩합니다.
enable_tiling
< source >( tile_sample_min_height: int | None = Nonetile_sample_min_width: int | None = Nonetile_sample_stride_height: float | None = Nonetile_sample_stride_width: 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
< source >( sample: Tensorsample_posterior: bool = Falsereturn_dict: bool = Truegenerator: typing.Optional[torch.Generator] = None ) → ~models.vae.DecoderOutput or tuple
매개변수
- 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이 반환됩니다.
tiled_decode
< source >( z: Tensorreturn_dict: bool = True ) → ~models.vae.DecoderOutput or tuple
tiled decoder를 사용하여 이미지 배치(decoding)를 디코딩합니다.
tiled_encode
< source >( x: Tensor ) → torch.Tensor
타일 인코더를 사용하여 이미지 배치 인코딩
AutoencoderKLOutput
클래스 diffusers.models.modeling_outputs.AutoencoderKLOutput
< source >( latent_dist: DiagonalGaussianDistribution )
AutoencoderKL 인코딩 메서드의 출력.
DecoderOutput
class diffusers.models.autoencoders.vae.DecoderOutput
< source >( sample: Tensorcommit_loss: typing.Optional[torch.FloatTensor] = None )
디코딩 메서드의 출력.