Buckets:
| import"../chunks/DsnmJJEf.js";import{i as E,h as z,C as G,H as p,a as V,D as o,E as Z,s as j}from"../chunks/CmJXCtRL.js";import{p as F,o as C,s as e,f as R,a as W,b as U,c as t,d as y,n as r,r as n}from"../chunks/DK803DsY.js";const q='{"title":"AutoencoderKLWan","local":"autoencoderklwan","sections":[{"title":"AutoencoderKLWan","local":"diffusers.AutoencoderKLWan","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';var H=y('<meta name="hf:doc:metadata"/>'),X=y(`<p></p> <!> <!> <p>The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/Wan-Video/Wan2.1" rel="nofollow">Wan 2.1</a> by the Alibaba Wan Team.</p> <p>The model can be loaded with the following code snippet.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. | |
| Introduced in [Wan 2.1].</p> <p>This model inherits from <a href="/docs/diffusers/pr_14204/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for it’s generic methods implemented | |
| for all models (such as downloading or saving).</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Decode a batch of images.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to | |
| compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow | |
| processing larger images.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encode a batch of images into latents.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Decode a batch of images using a tiled decoder.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encode a batch of images using a tiled encoder.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Output of decoding method.</p></div> <!> <p></p>`,1);function P(L,A){F(A,!1),C(()=>{new URLSearchParams(window.location.search).get("fw")}),E();var m=X();z("1epyubn",x=>{var w=H();j(w,"content",q),W(x,w)});var h=e(R(m),2);G(h,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var f=e(h,2);p(f,{title:"AutoencoderKLWan",local:"autoencoderklwan",headingTag:"h1"});var _=e(f,6);V(_,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xXYW4lMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMV2FuLmZyb21fcHJldHJhaW5lZCglMjJXYW4tQUklMkZXYW4yLjEtVDJWLTEuM0ItRGlmZnVzZXJzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan | |
| vae = AutoencoderKLWan.from_pretrained(<span class="hljs-string">"Wan-AI/Wan2.1-T2V-1.3B-Diffusers"</span>, subfolder=<span class="hljs-string">"vae"</span>, torch_dtype=torch.float32)`,lang:"python",wrap:!1});var g=e(_,2);p(g,{title:"AutoencoderKLWan",local:"diffusers.AutoencoderKLWan",headingTag:"h2"});var a=e(g,2),v=t(a);o(v,{name:"class diffusers.AutoencoderKLWan",anchor:"diffusers.AutoencoderKLWan",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L960",parameters:[{name:"base_dim",val:": int = 96"},{name:"decoder_base_dim",val:": int | None = None"},{name:"z_dim",val:": int = 16"},{name:"dim_mult",val:": list = [1, 2, 4, 4]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_scales",val:": list = []"},{name:"temperal_downsample",val:": list = [False, True, True]"},{name:"dropout",val:": float = 0.0"},{name:"latents_mean",val:": list = [-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921]"},{name:"latents_std",val:": list = [2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916]"},{name:"is_residual",val:": bool = False"},{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"patch_size",val:": int | None = None"},{name:"scale_factor_temporal",val:": int | None = 4"},{name:"scale_factor_spatial",val:": int | None = 8"}]});var d=e(v,6),D=t(d);o(D,{name:"decode",anchor:"diffusers.AutoencoderKLWan.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1218",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) — Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLWan.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is | |
| returned.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p> | |
| `}),r(2),n(d);var s=e(d,2),K=t(s);o(K,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLWan.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1093",parameters:[{name:"tile_sample_min_height",val:": int | None = None"},{name:"tile_sample_min_width",val:": int | None = None"},{name:"tile_sample_stride_height",val:": float | None = None"},{name:"tile_sample_stride_width",val:": float | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum height required for a sample to be separated into tiles across the height dimension.`,name:"tile_sample_min_height"},{anchor:"diffusers.AutoencoderKLWan.enable_tiling.tile_sample_min_width",description:`<strong>tile_sample_min_width</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum width required for a sample to be separated into tiles across the width dimension.`,name:"tile_sample_min_width"},{anchor:"diffusers.AutoencoderKLWan.enable_tiling.tile_sample_stride_height",description:`<strong>tile_sample_stride_height</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum amount of overlap between two consecutive vertical tiles. This is to ensure that there are | |
| no tiling artifacts produced across the height dimension.`,name:"tile_sample_stride_height"},{anchor:"diffusers.AutoencoderKLWan.enable_tiling.tile_sample_stride_width",description:`<strong>tile_sample_stride_width</strong> (<code>int</code>, <em>optional</em>) — | |
| The stride between two consecutive horizontal tiles. This is to ensure that there are no tiling | |
| artifacts produced across the width dimension.`,name:"tile_sample_stride_width"}]}),r(2),n(s);var i=e(s,2),O=t(i);o(O,{name:"encode",anchor:"diffusers.AutoencoderKLWan.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1160",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) — Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLWan.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a <code>~models.autoencoder_kl.AutoencoderKLOutput</code> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The latent representations of the encoded videos. If <code>return_dict</code> is True, a | |
| <code>~models.autoencoder_kl.AutoencoderKLOutput</code> is returned, otherwise a plain <code>tuple</code> is returned.</p> | |
| `}),r(2),n(i);var c=e(i,2),k=t(c);o(k,{name:"forward",anchor:"diffusers.AutoencoderKLWan.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1409",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLWan.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLWan.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AutoencoderKLWan.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make sampling | |
| deterministic.`,name:"generator"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is | |
| returned.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p> | |
| `}),n(c);var l=e(c,2),M=t(l);o(M,{name:"tiled_decode",anchor:"diffusers.AutoencoderKLWan.tiled_decode",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1331",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) — Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLWan.tiled_decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is | |
| returned.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p> | |
| `}),r(2),n(l);var b=e(l,2),N=t(b);o(N,{name:"tiled_encode",anchor:"diffusers.AutoencoderKLWan.tiled_encode",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1259",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) — Input batch of videos.",name:"x"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The latent representation of the encoded videos.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>torch.Tensor</code></p> | |
| `}),r(2),n(b),n(a);var T=e(a,2);p(T,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var u=e(T,2),I=t(u);o(I,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14204/src/diffusers/models/autoencoders/vae.py#L46",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.models.autoencoders.vae.DecoderOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — | |
| The decoded output sample from the last layer of the model.`,name:"sample"}]}),r(2),n(u);var J=e(u,2);Z(J,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_wan.md"}),r(2),W(L,m),U()}export{P as component}; | |
Xet Storage Details
- Size:
- 13.7 kB
- Xet hash:
- fadeb0b041576fbed36316bd01f5b8b6f96503745ed7e1cac5fd36f0e0c1eba6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.