Buckets:

hf-doc-build/doc / diffusers /main /ja /api /models /autoencoder_kl_kvae.md
mishig's picture
|
download
raw
5.7 kB

AutoencoderKLKVAE

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

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

import torch
from diffusers import AutoencoderKLKVAE

vae = AutoencoderKLKVAE.from_pretrained("kandinskylab/KVAE-2D-1.0", subfolder="diffusers", dtype=torch.bfloat16)

AutoencoderKLKVAE[[diffusers.AutoencoderKLKVAE]]

diffusers.AutoencoderKLKVAE[[diffusers.AutoencoderKLKVAE]]

diffusers.AutoencoderKLKVAE(in_channels: int = 3, channels: int = 128, num_enc_blocks: int = 2, num_dec_blocks: int = 2, z_channels: int = 16, double_z: bool = True, ch_mult: typing.Tuple[int, ...] = (1, 2, 4, 8), sample_size: int = 1024)

ソース

パラメータ:

in_channels (int, optional, デフォルトは 3) : 入力画像のチャネル数。

channels (int, optional, デフォルトは 128) : 多解像度ブロックにおけるベースのチャネル数。

num_enc_blocks (int, optional, デフォルトは 2) : エンコーダーのマルチリゾリューション層における Resnet ブロックの数。

num_dec_blocks (int, optional, デフォルトは 2) : デコーダーのマルチリゾリューション層における Resnet ブロックの数。

z_channels (int, optional, デフォルト値は 16) : 潜在空間のチャネル数。

double_z (bool、任意、デフォルトはTrue) : エンコーダーの出力チャネル数を2倍にするかどうか。

ch_mult (Tuple[int, ...]、任意、デフォルトは(1, 2, 4, 8)) : マルチリゾリューションブロックにおけるチャネル乗数です。

sample_size (int、任意、デフォルトは1024) : サンプル入力サイズ。

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

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

decode[[diffusers.AutoencoderKLKVAE.decode]]

decode(z: FloatTensor, return_dict: bool = True, generator = None)

ソース

パラメータ:

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

return_dict (bool、任意、デフォルトはTrue) : プレーンなタプルではなく~models.vae.DecoderOutputを返すかどうか。

戻り値: ~models.vae.DecoderOutput または tuple

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

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

encode[[diffusers.AutoencoderKLKVAE.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が返されます。

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

forward[[diffusers.AutoencoderKLKVAE.forward]]

forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None)

ソース

パラメータ:

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[[diffusers.AutoencoderKLKVAE.tiled_decode]]

tiled_decode(z: 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 が返されます。

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

Xet Storage Details

Size:
5.7 kB
·
Xet hash:
0571d8a5ea25c490d0bbd200784256cc68dfbf65514fa24c9eb54ccd0f29019b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.