Buckets:
| # AutoencoderKLMochi | |
| [Mochi](https://github.com/genmoai/models)で使用されているKL損失付き3次元変分オートエンコーダ(VAE)モデルは、清華大学およびZhipuAIによる[Mochi 1 Preview](https://huggingface.co/genmo/mochi-1-preview)で導入されました。 | |
| モデルは、以下のコードスニペットで読み込むことができます。 | |
| ```python | |
| from diffusers import AutoencoderKLMochi | |
| vae = AutoencoderKLMochi.from_pretrained("genmo/mochi-1-preview", subfolder="vae", dtype=torch.float32).to("cuda") # or "mps", "xpu", "cpu" | |
| ``` | |
| ## AutoencoderKLMochi[[diffusers.AutoencoderKLMochi]] | |
| #### diffusers.AutoencoderKLMochi[[diffusers.AutoencoderKLMochi]] | |
| ```python | |
| diffusers.AutoencoderKLMochi(in_channels: int = 15, out_channels: int = 3, encoder_block_out_channels: tuple[int] = (64, 128, 256, 384), decoder_block_out_channels: tuple[int] = (128, 256, 512, 768), latent_channels: int = 12, layers_per_block: tuple[int, ...] = (3, 3, 4, 6, 3), act_fn: str = 'silu', temporal_expansions: tuple[int, ...] = (1, 2, 3), spatial_expansions: tuple[int, ...] = (2, 2, 2), add_attention_block: tuple[bool, ...] = (False, True, True, True, True), latents_mean: tuple[float, ...] = (-0.06730895953510081, -0.038011381506090416, -0.07477820912866141, -0.05565264470995561, 0.012767231469026969, -0.04703542746246419, 0.043896967884726704, -0.09346305707025976, -0.09918314763016893, -0.008729793427399178, -0.011931556316503654, -0.0321993391887285), latents_std: tuple[float, ...] = (0.9263795028493863, 0.9248894543193766, 0.9393059390890617, 0.959253732819592, 0.8244560132752793, 0.917259975397747, 0.9294154431013696, 1.3720942357788521, 0.881393668867029, 0.9168315692124348, 0.9185249279345552, 0.9274757570805041), scaling_factor: float = 1.0) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L655) | |
| **パラメータ:** | |
| in_channels (int, *optional*, デフォルトは 3) : 入力画像のチャネル数。 | |
| out_channels (int, *optional*, デフォルトは 3) : 出力のチャネル数。 | |
| block_out_channels (`tuple[int]`、*optional*、デフォルトは`(64,)`) : ブロックの出力チャネルのタプル。 | |
| act_fn (`str`、*任意*、デフォルトは`"silu"`) : 使用する活性化関数。 | |
| scaling_factor (`float`、*任意*、デフォルトは `1.15258426`) : 学習済み潜在空間の要素ごとの標準偏差です。これは、学習セットの最初のバッチを使用して計算されます。拡散モデルの学習時に、潜在空間を分散 1 にスケーリングするために使用されます。潜在変数は、拡散モデルに渡される前に `z = z * scaling_factor` という式でスケーリングされます。デコード時には、`z = 1 / scaling_factor * z` という式で元のスケールに戻されます。詳細については、[High-Resolution Image Synthesis with Latent Diffusion Models](https://huggingface.co/papers/2112.10752) 論文のセクション 4.3.2 と D.1 を参照してください。 | |
| KL損失を用いて画像を潜在変数にエンコードし、潜在表現を画像にデコードするためのVAEモデル。[Mochi 1 preview](https://github.com/genmoai/models)で使用されます。 | |
| このモデルは [ModelMixin](/docs/diffusers/main/ja/api/models/overview#diffusers.ModelMixin) を継承しています。すべてのモデルに実装されている汎用的なメソッド(ダウンロードや保存など)については、スーパークラスのドキュメントを参照してください。 | |
| #### decode[[diffusers.AutoencoderKLMochi.decode]] | |
| ```python | |
| decode(z: Tensor, return_dict: bool = True) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L912) | |
| **パラメータ:** | |
| z (`torch.Tensor`) : 潜在ベクトルの入力バッチ。 | |
| return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.vae.DecoderOutput`を返すかどうか。 | |
| **戻り値:** `~models.vae.DecoderOutput` または `tuple` | |
| return_dict が True の場合、`~models.vae.DecoderOutput` が返され、それ以外の場合は通常の `tuple` が返されます。 | |
| 画像のバッチをデコードします。 | |
| #### enable_tiling[[diffusers.AutoencoderKLMochi.enable_tiling]] | |
| ```python | |
| enable_tiling(tile_sample_min_height: int | None = None, tile_sample_min_width: int | None = None, tile_sample_stride_height: float | None = None, tile_sample_stride_width: float | None = None) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L786) | |
| **パラメータ:** | |
| 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は入力テンソルをタイルに分割し、デコーディングとエンコーディングを複数ステップで計算します。これにより、大量のメモリを節約し、より大きな画像の処理を可能にします。 | |
| #### encode[[diffusers.AutoencoderKLMochi.encode]] | |
| ```python | |
| encode(x: Tensor, return_dict: bool = True) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L855) | |
| **パラメータ:** | |
| x (`torch.Tensor`) : 画像の入力バッチ。 | |
| return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.autoencoder_kl.AutoencoderKLOutput`を返すかどうか。 | |
| **戻り値:** | |
| エンコードされた動画の潜在表現。`return_dict`がTrueの場合、`~models.autoencoder_kl.AutoencoderKLOutput`が返され、それ以外の場合は通常の`tuple`が返されます。 | |
| バッチの画像を潜在変数にエンコードします。 | |
| #### forward[[diffusers.AutoencoderKLMochi.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_mochi.py#L1089) | |
| **パラメータ:** | |
| 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.AutoencoderKLMochi.tiled_decode]] | |
| ```python | |
| tiled_decode(z: Tensor, return_dict: bool = True) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1011) | |
| **パラメータ:** | |
| z (`torch.Tensor`) : 潜在ベクトルの入力バッチ。 | |
| return_dict (`bool`、*任意*、デフォルトは`True`) : プレーンなタプルではなく`~models.vae.DecoderOutput`を返すかどうか。 | |
| **戻り値:** `~models.vae.DecoderOutput` または `tuple` | |
| return_dict が True の場合、`~models.vae.DecoderOutput` が返され、それ以外の場合は通常の `tuple` が返されます。 | |
| タイル化されたデコーダーを使用して、画像のバッチをデコードします。 | |
| #### tiled_encode[[diffusers.AutoencoderKLMochi.tiled_encode]] | |
| ```python | |
| tiled_encode(x: Tensor) | |
| ``` | |
| [ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L954) | |
| **パラメータ:** | |
| x (`torch.Tensor`) : 入力バッチの動画。 | |
| **戻り値:** `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:
- 9.6 kB
- Xet hash:
- 377a8187c0e3d7b1e939bf35f6053c9c3eaaba1983b4d22f283a11042fb67f22
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.