Diffusers documentation
AutoencoderKLHunyuanVideo15
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
< source >( 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
< source >( z: Tensorreturn_dict: bool = True ) → ~models.vae.DecoderOutput or tuple
画像のバッチをデコードします。
encode
< source >( x: Tensorreturn_dict: bool = True )
バッチの画像を潜在変数にエンコードします。
enable_tiling
< source >( 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 )
タイル化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: Tensor ) → torch.Tensor
タイル化されたデコーダーを使用して、画像のバッチをデコードします。
tiled_encode
< source >( x: Tensor ) → torch.Tensor
タイル化されたエンコーダーを使用して、画像のバッチをエンコードします。
DecoderOutput
class diffusers.models.autoencoders.vae.DecoderOutput
< source >( sample: Tensorcommit_loss: typing.Optional[torch.FloatTensor] = None )
デコードメソッドの出力。