Diffusers documentation

AutoencoderKLHunyuanVideo15

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

AutoencoderKLHunyuanVideo15

Tencent の HunyuanVideo1.5 で使用される、KL 損失付きの 3 次元変分オートエンコーダ (VAE) モデルです。

モデルは、以下のコードスニペットで読み込むことができます。

from diffusers import AutoencoderKLHunyuanVideo15

vae = AutoencoderKLHunyuanVideo15.from_pretrained("hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-480p_t2v", subfolder="vae", dtype=torch.float32)

# make sure to enable tiling to avoid OOM
vae.enable_tiling()

AutoencoderKLHunyuanVideo15

class diffusers.AutoencoderKLHunyuanVideo15

< >

( in_channels: int = 3out_channels: int = 3latent_channels: int = 32block_out_channels: tuple = (128, 256, 512, 1024, 1024)layers_per_block: int = 2spatial_compression_ratio: int = 16temporal_compression_ratio: int = 4downsample_match_channel: bool = Trueupsample_match_channel: bool = Truescaling_factor: float = 1.03682 )

KL損失を用いて動画を潜在変数にエンコードし、潜在表現を動画にデコードするためのVAEモデルです。HunyuanVideo-1.5で使用されます。

このモデルは ModelMixin を継承しています。すべてのモデルに実装されている汎用的なメソッド(ダウンロードや保存など)については、スーパークラスのドキュメントを参照してください。

decode

< >

( z: Tensorreturn_dict: bool = True ) → ~models.vae.DecoderOutput or tuple

パラメータ

  • z (torch.Tensor) — 潜在ベクトルの入力バッチ。
  • return_dict (bool、省略可、デフォルトはTrue) — ~models.vae.DecoderOutputを返すか、プレーンなタプルを返すかを指定します。

戻り値

~models.vae.DecoderOutput または tuple

return_dict が True の場合、~models.vae.DecoderOutput が返され、それ以外の場合は通常の tuple が返されます。

画像のバッチをデコードします。

encode

< >

( x: Tensorreturn_dict: bool = True )

パラメータ

  • x (torch.Tensor) — 画像の入力バッチ。
  • return_dict (bool、省略可、デフォルトはTrue) — ~models.autoencoder_kl.AutoencoderKLOutputを返すか、プレーンなタプルを返すかを指定します。

バッチの画像を潜在変数にエンコードします。

enable_tiling

< >

( tile_sample_min_height: int | None = Nonetile_sample_min_width: int | None = Nonetile_latent_min_height: int | None = Nonetile_latent_min_width: int | None = Nonetile_overlap_factor: float | None = None )

パラメータ

  • tile_sample_min_height (int, 任意) — サンプルを高さ方向にタイル分割するために必要な最小高さ。
  • tile_sample_min_width (int, 任意) — 幅方向にサンプルをタイルに分割するために必要な最小幅です。
  • tile_latent_min_height (int, 任意) — 高さ次元にわたって latent をタイルに分割するために必要な最小高さです。
  • tile_latent_min_width (int, 任意) — 幅方向にタイルへ分割されるために、潜在変数に求められる最小幅です。

タイル化VAEデコーディングを有効にします。このオプションを有効にすると、VAEは入力テンソルをタイルに分割し、デコーディングとエンコーディングを複数ステップで計算します。これにより、大量のメモリを節約し、より大きな画像の処理を可能にします。

forward

< >

( 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

< >

( z: Tensor ) → torch.Tensor

パラメータ

  • z (torch.Tensor) — 潜在ベクトルの入力バッチ。

戻り値

torch.Tensor

デコードされた画像。

タイル化されたデコーダーを使用して、画像のバッチをデコードします。

tiled_encode

< >

( x: Tensor ) → torch.Tensor

パラメータ

  • x (torch.Tensor) — 入力バッチの動画。

戻り値

torch.Tensor

エンコードされた動画の潜在表現。

タイル化されたエンコーダーを使用して、画像のバッチをエンコードします。

DecoderOutput

class diffusers.models.autoencoders.vae.DecoderOutput

< >

( sample: Tensorcommit_loss: typing.Optional[torch.FloatTensor] = None )

パラメータ

  • sample (torch.Tensor、形状 (batch_size, num_channels, height, width)) — モデルの最終層からのデコード済み出力サンプルです。

デコードメソッドの出力。

Update on GitHub