Diffusers documentation
AutoencoderKLKVAEVideo
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
< source >( 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
< source >( z: Tensorreturn_dict: bool = True ) → ~models.vae.DecoderOutput or tuple
バッチの動画をデコードします。
スライスされたVAEデコーディングを無効にします。
スライスされたVAEデコーディングを有効にします。
encode
< source >( x: Tensorreturn_dict: bool = True )
バッチの動画を潜在変数にエンコードします。
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 が返されます。