Buckets:
AutoencoderKLLTXVideo
LTXで使用されているKL損失付き3次元変分オートエンコーダ(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[int, ...] = (128, 256, 512, 512), down_block_types: tuple[str, ...] = ('LTXVideoDownBlock3D', 'LTXVideoDownBlock3D', 'LTXVideoDownBlock3D', 'LTXVideoDownBlock3D'), decoder_block_out_channels: tuple[int, ...] = (128, 256, 512, 512), layers_per_block: tuple[int, ...] = (4, 3, 3, 3, 4), decoder_layers_per_block: tuple[int, ...] = (4, 3, 3, 3, 4), spatio_temporal_scaling: tuple[bool, ...] = (True, True, True, False), decoder_spatio_temporal_scaling: tuple[bool, ...] = (True, True, True, False), decoder_inject_noise: tuple[bool, ...] = (False, False, False, False, False), downsample_type: tuple[str, ...] = ('conv', 'conv', 'conv', 'conv'), upsample_residual: tuple[bool, ...] = (False, False, False, False), upsample_factor: tuple[int, ...] = (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)` : ブロックに時空間ダウンスケール処理を含めるかどうか。
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) : 学習セットの最初のバッチを使用して計算された、学習済み潜在空間の要素ごとの標準偏差です。これは、拡散モデルの学習時に潜在空間を分散 1 にスケーリングするために使用されます。潜在変数は、拡散モデルに渡される前に 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 が返されます。
画像のバッチをデコードします。
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が返されます。
バッチの画像を潜在変数にエンコードします。
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, optional) : サンプルを高さ方向にタイル分割するために必要な最小高さ。
tile_sample_min_width (int, optional) : サンプルを幅方向にタイル分割するために必要な最小幅。
tile_sample_stride_height (int, 任意) : 2つの連続する垂直タイル間の最小オーバーラップ量です。これにより、高さ方向にタイルリングアーティファクトが発生しないことを保証します。
tile_sample_stride_width (int, 任意) : 連続する2つの水平タイル間のストライドです。これにより、幅方向にタイル化によるアーティファクトが発生しないことを保証します。
タイル化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_encode[[diffusers.AutoencoderKLLTXVideo.tiled_encode]]
tiled_encode(x: Tensor)
パラメータ:
x (torch.Tensor) : 入力バッチの動画。
戻り値: torch.Tensor
エンコードされた動画の潜在表現。
タイル化されたエンコーダーを使用して、画像のバッチをエンコードします。
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 の平均と logvar として表したものです。DiagonalGaussianDistribution を使用すると、この分布から潜在変数をサンプリングできます。
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、形状 (batch_size, num_channels, height, width)) : モデルの最終層からのデコード済み出力サンプル。
デコードメソッドの出力。
Xet Storage Details
- Size:
- 11.7 kB
- Xet hash:
- 0e6374f3a9f40d3c6fde1a04bcd6bce81d9a69653e7b8710106a3202452e2c59
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.