Buckets:

hf-doc-build/doc / diffusers /main /ja /api /models /autoencoder_kl_hunyuanimage.md
mishig's picture
|
download
raw
6.93 kB
# AutoencoderKLHunyuanImage
[HunyuanImage2.1]で使用されたKL損失付き2次元変分オートエンコーダ(VAE)モデル。
モデルは、以下のコードスニペットで読み込むことができます。
```python
from diffusers import AutoencoderKLHunyuanImage
vae = AutoencoderKLHunyuanImage.from_pretrained("hunyuanvideo-community/HunyuanImage-2.1-Diffusers", subfolder="vae", dtype=torch.bfloat16)
```
## AutoencoderKLHunyuanImage[[diffusers.AutoencoderKLHunyuanImage]]
#### diffusers.AutoencoderKLHunyuanImage[[diffusers.AutoencoderKLHunyuanImage]]
```python
diffusers.AutoencoderKLHunyuanImage(in_channels: int, out_channels: int, latent_channels: int, block_out_channels: tuple[int, ...], layers_per_block: int, spatial_compression_ratio: int, sample_size: int, scaling_factor: float = None, downsample_match_channel: bool = True, upsample_match_channel: bool = True)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L412)
空間タイル分割をサポートする2D画像用のVAEモデル。
このモデルは [ModelMixin](/docs/diffusers/main/ja/api/models/overview#diffusers.ModelMixin) を継承しています。すべてのモデルに実装されている汎用的なメソッド(ダウンロードや保存など)については、スーパークラスのドキュメントを参照してください。
#### decode[[diffusers.AutoencoderKLHunyuanImage.decode]]
```python
decode(z: Tensor, return_dict: bool = True)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L540)
**パラメータ:**
z (`torch.Tensor`) : 潜在ベクトルの入力バッチ。
return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.vae.DecoderOutput`を返すかどうか。
**戻り値:** `~models.vae.DecoderOutput` または `tuple`
return_dict が True の場合、`~models.vae.DecoderOutput` が返され、それ以外の場合は通常の `tuple` が返されます。
画像のバッチをデコードします。
#### enable_tiling[[diffusers.AutoencoderKLHunyuanImage.enable_tiling]]
```python
enable_tiling(tile_sample_min_size: int | None = None, tile_overlap_factor: float | None = None)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L467)
**パラメータ:**
tile_sample_min_size (`int`, *optional*) : サンプルを空間次元方向にタイル分割するために必要な最小サイズ。
tile_overlap_factor (`float`, *任意*) : 潜在変数を空間次元に沿ってタイルに分割するために必要なオーバーラップ係数。
空間タイルVAEデコーディングを有効にします。このオプションを有効にすると、VAEは入力テンソルをタイルに分割し、デコーディングとエンコーディングを複数ステップで計算します。これにより、大量のメモリを節約し、より大きな画像の処理を可能にします。
#### encode[[diffusers.AutoencoderKLHunyuanImage.encode]]
```python
encode(x: Tensor, return_dict: bool = True)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L499)
**パラメータ:**
x (`torch.Tensor`) : 画像の入力バッチ。
return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.autoencoder_kl.AutoencoderKLOutput`を返すかどうか。
**戻り値:**
エンコードされた動画の潜在表現。`return_dict`がTrueの場合、`~models.autoencoder_kl.AutoencoderKLOutput`が返され、それ以外の場合は通常の`tuple`が返されます。
バッチの画像を潜在変数にエンコードします。
#### forward[[diffusers.AutoencoderKLHunyuanImage.forward]]
```python
forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L667)
**パラメータ:**
sample (`torch.Tensor`) : 入力サンプル。
sample_posterior (`bool`、*任意*、デフォルトは`False`) : 事後分布からサンプリングするかどうか。
return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`DecoderOutput`を返すかどうか。
generator (`torch.Generator`, *任意*) : サンプリングを決定論的にするための [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html)。
**戻り値:** `~models.vae.DecoderOutput` または `tuple`
`return_dict` が True の場合、`~models.vae.DecoderOutput` が返され、それ以外の場合は通常の `tuple` が返されます。
#### tiled_decode[[diffusers.AutoencoderKLHunyuanImage.tiled_decode]]
```python
tiled_decode(z: Tensor, return_dict: bool = True)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L622)
**パラメータ:**
z (`torch.Tensor`) : 形状が (B, C, H, W) の潜在テンソル。
return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.vae.DecoderOutput`を返すかどうか。
**戻り値:** `~models.vae.DecoderOutput` または `tuple`
return_dict が True の場合、`~models.vae.DecoderOutput` が返され、それ以外の場合は通常の `tuple` が返されます。
空間タイル戦略を使用して潜在変数をデコードします。
#### tiled_encode[[diffusers.AutoencoderKLHunyuanImage.tiled_encode]]
```python
tiled_encode(x: Tensor)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py#L582)
**パラメータ:**
x (`torch.Tensor`) : 形状が (B, C, T, H, W) の入力テンソル。
**戻り値:** `torch.Tensor`
エンコードされた画像の潜在表現。
空間タイル戦略を使用して入力をエンコードします。
## DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]
#### diffusers.models.autoencoders.vae.DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]
```python
diffusers.models.autoencoders.vae.DecoderOutput(sample: Tensor, commit_loss: typing.Optional[torch.FloatTensor] = None)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/vae.py#L49)
**パラメータ:**
sample (`torch.Tensor`、形状 `(batch_size, num_channels, height, width)`) : モデルの最終層からのデコード済み出力サンプル。
デコードメソッドの出力。

Xet Storage Details

Size:
6.93 kB
·
Xet hash:
b2f4b092df3a50146f844b0bc4f6739932041e8a9faf318786d0ad5a03ed9d89

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