Diffusers documentation

AutoencoderKLKVAEVideo

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

AutoencoderKLKVAEVideo

KL損失付きの3次元変分オートエンコーダ(VAE)モデル。

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

import torch
from diffusers import AutoencoderKLKVAEVideo

vae = AutoencoderKLKVAEVideo.from_pretrained("kandinskylab/KVAE-3D-1.0", subfolder="diffusers", dtype=torch.float16)

AutoencoderKLKVAEVideo

class diffusers.AutoencoderKLKVAEVideo

< >

( ch: int = 128ch_mult: typing.Tuple[int, ...] = (1, 2, 4, 8)num_res_blocks: int = 2in_channels: int = 3out_ch: int = 3z_channels: int = 16temporal_compress_times: int = 4 )

パラメータ

  • ch (int、任意、デフォルトは 128) — 基本チャネル数。
  • ch_mult (Tuple[int]、任意、デフォルトは (1, 2, 4, 8)) — レベルごとのチャネル乗数。
  • num_res_blocks (int、任意、デフォルト値は 2) — レベルごとの残差ブロックの数。
  • in_channels (int、任意、デフォルトは 3) — 入力チャネル数。
  • out_ch (int、任意、デフォルトは 3) — 出力チャネル数。
  • z_channels (int、任意、デフォルト値は 16) — 潜在チャネルの数。
  • temporal_compress_times (int、任意、デフォルトは 4) — 時間方向の圧縮係数。

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

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

decode

< >

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

パラメータ

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

戻り値

~models.vae.DecoderOutput または tuple

デコードされた動画。

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

disable_slicing

< >

( )

スライスされたVAEデコーディングを無効にします。

enable_slicing

< >

( )

スライスされたVAEデコーディングを有効にします。

encode

< >

( x: Tensorreturn_dict: bool = True )

パラメータ

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

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

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 が返されます。

Update on GitHub