import{s as Je,n as Pe,o as Ze}from"../chunks/scheduler.53228c21.js";import{S as ze,i as Ge,e as i,s as o,c,h as je,a as d,d as t,b as r,f as $,g as p,j as T,k as b,l as a,m as l,n as u,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as Ne}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as z}from"../chunks/Docstring.46d0934e.js";import{C as He}from"../chunks/CodeBlock.d30a6509.js";import{H as Le,E as Fe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function qe(We){let _,Y,S,B,L,Q,W,ee,D,De='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.',te,A,Ae="The model can be loaded with the following code snippet.",ne,C,oe,K,re,s,E,fe,G,Ce=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.
Introduced in [Wan 2.1].`,ge,j,Ke=`This model inherits from <a href="/docs/diffusers/main/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).`,he,N,M,_e,w,O,ve,H,Ee=`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.`,$e,F,V,be,x,k,we,q,Me="Decode a batch of images using a tiled decoder.",xe,y,I,ye,R,Oe="Encode a batch of images using a tiled encoder.",ae,J,se,v,P,Te,U,Ve="Output of decoding method.",ie,Z,de,X,le;return L=new Ne({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),W=new Le({props:{title:"AutoencoderKLWan",local:"autoencoderklwan",headingTag:"h1"}}),C=new He({props:{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">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)`,wrap:!1}}),K=new Le({props:{title:"AutoencoderKLWan",local:"diffusers.AutoencoderKLWan",headingTag:"h2"}}),E=new z({props:{name:"class diffusers.AutoencoderKLWan",anchor:"diffusers.AutoencoderKLWan",parameters:[{name:"base_dim",val:": int = 96"},{name:"decoder_base_dim",val:": typing.Optional[int] = None"},{name:"z_dim",val:": int = 16"},{name:"dim_mult",val:": typing.List[int] = [1, 2, 4, 4]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_scales",val:": typing.List[float] = []"},{name:"temperal_downsample",val:": typing.List[bool] = [False, True, True]"},{name:"dropout",val:": float = 0.0"},{name:"latents_mean",val:": typing.List[float] = [-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:": typing.List[float] = [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:": typing.Optional[int] = None"},{name:"scale_factor_temporal",val:": typing.Optional[int] = 4"},{name:"scale_factor_spatial",val:": typing.Optional[int] = 8"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L955"}}),M=new z({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLWan.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),O=new z({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLWan.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": typing.Optional[int] = None"},{name:"tile_sample_min_width",val:": typing.Optional[int] = None"},{name:"tile_sample_stride_height",val:": typing.Optional[float] = None"},{name:"tile_sample_stride_width",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1088"}}),V=new z({props:{name:"forward",anchor:"diffusers.AutoencoderKLWan.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLWan.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1404"}}),k=new z({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLWan.tiled_decode",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>) &#x2014; 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>) &#x2014;
Whether or not to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1326",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>
`}}),I=new z({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLWan.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLWan.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of videos.",name:"x"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1254",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>
`}}),J=new Le({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),P=new z({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",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>) &#x2014;
The decoded output sample from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/vae.py#L47"}}),Z=new Fe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_wan.md"}}),{c(){_=i("meta"),Y=o(),S=i("p"),B=o(),c(L.$$.fragment),Q=o(),c(W.$$.fragment),ee=o(),D=i("p"),D.innerHTML=De,te=o(),A=i("p"),A.textContent=Ae,ne=o(),c(C.$$.fragment),oe=o(),c(K.$$.fragment),re=o(),s=i("div"),c(E.$$.fragment),fe=o(),G=i("p"),G.textContent=Ce,ge=o(),j=i("p"),j.innerHTML=Ke,he=o(),N=i("div"),c(M.$$.fragment),_e=o(),w=i("div"),c(O.$$.fragment),ve=o(),H=i("p"),H.textContent=Ee,$e=o(),F=i("div"),c(V.$$.fragment),be=o(),x=i("div"),c(k.$$.fragment),we=o(),q=i("p"),q.textContent=Me,xe=o(),y=i("div"),c(I.$$.fragment),ye=o(),R=i("p"),R.textContent=Oe,ae=o(),c(J.$$.fragment),se=o(),v=i("div"),c(P.$$.fragment),Te=o(),U=i("p"),U.textContent=Ve,ie=o(),c(Z.$$.fragment),de=o(),X=i("p"),this.h()},l(e){const n=je("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(t),Y=r(e),S=d(e,"P",{}),$(S).forEach(t),B=r(e),p(L.$$.fragment,e),Q=r(e),p(W.$$.fragment,e),ee=r(e),D=d(e,"P",{"data-svelte-h":!0}),T(D)!=="svelte-tl45xs"&&(D.innerHTML=De),te=r(e),A=d(e,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1vuni30"&&(A.textContent=Ae),ne=r(e),p(C.$$.fragment,e),oe=r(e),p(K.$$.fragment,e),re=r(e),s=d(e,"DIV",{class:!0});var m=$(s);p(E.$$.fragment,m),fe=r(m),G=d(m,"P",{"data-svelte-h":!0}),T(G)!=="svelte-1cxmnva"&&(G.textContent=Ce),ge=r(m),j=d(m,"P",{"data-svelte-h":!0}),T(j)!=="svelte-1hyu2ru"&&(j.innerHTML=Ke),he=r(m),N=d(m,"DIV",{class:!0});var ke=$(N);p(M.$$.fragment,ke),ke.forEach(t),_e=r(m),w=d(m,"DIV",{class:!0});var me=$(w);p(O.$$.fragment,me),ve=r(me),H=d(me,"P",{"data-svelte-h":!0}),T(H)!=="svelte-1xwrf7t"&&(H.textContent=Ee),me.forEach(t),$e=r(m),F=d(m,"DIV",{class:!0});var Ie=$(F);p(V.$$.fragment,Ie),Ie.forEach(t),be=r(m),x=d(m,"DIV",{class:!0});var ce=$(x);p(k.$$.fragment,ce),we=r(ce),q=d(ce,"P",{"data-svelte-h":!0}),T(q)!=="svelte-1vrxp2b"&&(q.textContent=Me),ce.forEach(t),xe=r(m),y=d(m,"DIV",{class:!0});var pe=$(y);p(I.$$.fragment,pe),ye=r(pe),R=d(pe,"P",{"data-svelte-h":!0}),T(R)!=="svelte-1un5fcn"&&(R.textContent=Oe),pe.forEach(t),m.forEach(t),ae=r(e),p(J.$$.fragment,e),se=r(e),v=d(e,"DIV",{class:!0});var ue=$(v);p(P.$$.fragment,ue),Te=r(ue),U=d(ue,"P",{"data-svelte-h":!0}),T(U)!=="svelte-18u8upa"&&(U.textContent=Ve),ue.forEach(t),ie=r(e),p(Z.$$.fragment,e),de=r(e),X=d(e,"P",{}),$(X).forEach(t),this.h()},h(){b(_,"name","hf:doc:metadata"),b(_,"content",Re),b(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){a(document.head,_),l(e,Y,n),l(e,S,n),l(e,B,n),u(L,e,n),l(e,Q,n),u(W,e,n),l(e,ee,n),l(e,D,n),l(e,te,n),l(e,A,n),l(e,ne,n),u(C,e,n),l(e,oe,n),u(K,e,n),l(e,re,n),l(e,s,n),u(E,s,null),a(s,fe),a(s,G),a(s,ge),a(s,j),a(s,he),a(s,N),u(M,N,null),a(s,_e),a(s,w),u(O,w,null),a(w,ve),a(w,H),a(s,$e),a(s,F),u(V,F,null),a(s,be),a(s,x),u(k,x,null),a(x,we),a(x,q),a(s,xe),a(s,y),u(I,y,null),a(y,ye),a(y,R),l(e,ae,n),u(J,e,n),l(e,se,n),l(e,v,n),u(P,v,null),a(v,Te),a(v,U),l(e,ie,n),u(Z,e,n),l(e,de,n),l(e,X,n),le=!0},p:Pe,i(e){le||(f(L.$$.fragment,e),f(W.$$.fragment,e),f(C.$$.fragment,e),f(K.$$.fragment,e),f(E.$$.fragment,e),f(M.$$.fragment,e),f(O.$$.fragment,e),f(V.$$.fragment,e),f(k.$$.fragment,e),f(I.$$.fragment,e),f(J.$$.fragment,e),f(P.$$.fragment,e),f(Z.$$.fragment,e),le=!0)},o(e){g(L.$$.fragment,e),g(W.$$.fragment,e),g(C.$$.fragment,e),g(K.$$.fragment,e),g(E.$$.fragment,e),g(M.$$.fragment,e),g(O.$$.fragment,e),g(V.$$.fragment,e),g(k.$$.fragment,e),g(I.$$.fragment,e),g(J.$$.fragment,e),g(P.$$.fragment,e),g(Z.$$.fragment,e),le=!1},d(e){e&&(t(Y),t(S),t(B),t(Q),t(ee),t(D),t(te),t(A),t(ne),t(oe),t(re),t(s),t(ae),t(se),t(v),t(ie),t(de),t(X)),t(_),h(L,e),h(W,e),h(C,e),h(K,e),h(E),h(M),h(O),h(V),h(k),h(I),h(J,e),h(P),h(Z,e)}}}const Re='{"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}';function Ue(We){return Ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends ze{constructor(_){super(),Ge(this,_,Ue,qe,Je,{})}}export{tt as component};
