import{s as rt,n as at,o as st}from"../chunks/scheduler.53228c21.js";import{S as it,i as dt,e as i,s as o,c as m,h as lt,a as d,d as n,b as r,f as _,g as u,j as v,k as b,l as t,m as c,n as p,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as ct}from"../chunks/CopyLLMTxtMenu.2cdbb51f.js";import{D as $}from"../chunks/Docstring.d46840f1.js";import{C as mt}from"../chunks/CodeBlock.d30a6509.js";import{H as je,E as ut}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3fcbbc76.js";function pt(Ne){let w,se,re,ie,C,de,E,le,K,Fe='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.',ce,M,qe="The model can be loaded with the following code snippet.",me,V,ue,k,pe,a,I,We,R,Re=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.
Introduced in [Wan 2.1].`,Ae,U,Ue=`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).`,De,S,O,Ce,y,J,Ee,X,Se=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ke,L,P,Me,Y,Xe=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ve,T,z,ke,B,Ye=`Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.`,Ie,W,H,Oe,Q,Be=`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.`,Je,ee,Z,Pe,A,G,ze,te,Qe="Decode a batch of images using a tiled decoder.",He,D,j,Ze,ne,et="Encode a batch of images using a tiled encoder.",fe,N,ge,x,F,Ge,oe,tt="Output of decoding method.",he,q,_e,ae,be;return C=new ct({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),E=new je({props:{title:"AutoencoderKLWan",local:"autoencoderklwan",headingTag:"h1"}}),V=new mt({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 je({props:{title:"AutoencoderKLWan",local:"diffusers.AutoencoderKLWan",headingTag:"h2"}}),I=new $({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.Tuple[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#L954"}}),O=new $({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"}}),J=new $({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLWan.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1127"}}),P=new $({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLWan.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1113"}}),z=new $({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLWan.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1120"}}),H=new $({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#L1083"}}),Z=new $({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#L1399"}}),G=new $({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#L1336",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>
`}}),j=new $({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#L1270",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>
`}}),N=new je({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),F=new $({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"}}),q=new ut({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_wan.md"}}),{c(){w=i("meta"),se=o(),re=i("p"),ie=o(),m(C.$$.fragment),de=o(),m(E.$$.fragment),le=o(),K=i("p"),K.innerHTML=Fe,ce=o(),M=i("p"),M.textContent=qe,me=o(),m(V.$$.fragment),ue=o(),m(k.$$.fragment),pe=o(),a=i("div"),m(I.$$.fragment),We=o(),R=i("p"),R.textContent=Re,Ae=o(),U=i("p"),U.innerHTML=Ue,De=o(),S=i("div"),m(O.$$.fragment),Ce=o(),y=i("div"),m(J.$$.fragment),Ee=o(),X=i("p"),X.innerHTML=Se,Ke=o(),L=i("div"),m(P.$$.fragment),Me=o(),Y=i("p"),Y.innerHTML=Xe,Ve=o(),T=i("div"),m(z.$$.fragment),ke=o(),B=i("p"),B.textContent=Ye,Ie=o(),W=i("div"),m(H.$$.fragment),Oe=o(),Q=i("p"),Q.textContent=Be,Je=o(),ee=i("div"),m(Z.$$.fragment),Pe=o(),A=i("div"),m(G.$$.fragment),ze=o(),te=i("p"),te.textContent=Qe,He=o(),D=i("div"),m(j.$$.fragment),Ze=o(),ne=i("p"),ne.textContent=et,fe=o(),m(N.$$.fragment),ge=o(),x=i("div"),m(F.$$.fragment),Ge=o(),oe=i("p"),oe.textContent=tt,he=o(),m(q.$$.fragment),_e=o(),ae=i("p"),this.h()},l(e){const s=lt("svelte-u9bgzb",document.head);w=d(s,"META",{name:!0,content:!0}),s.forEach(n),se=r(e),re=d(e,"P",{}),_(re).forEach(n),ie=r(e),u(C.$$.fragment,e),de=r(e),u(E.$$.fragment,e),le=r(e),K=d(e,"P",{"data-svelte-h":!0}),v(K)!=="svelte-tl45xs"&&(K.innerHTML=Fe),ce=r(e),M=d(e,"P",{"data-svelte-h":!0}),v(M)!=="svelte-1vuni30"&&(M.textContent=qe),me=r(e),u(V.$$.fragment,e),ue=r(e),u(k.$$.fragment,e),pe=r(e),a=d(e,"DIV",{class:!0});var l=_(a);u(I.$$.fragment,l),We=r(l),R=d(l,"P",{"data-svelte-h":!0}),v(R)!=="svelte-1cxmnva"&&(R.textContent=Re),Ae=r(l),U=d(l,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1hyu2ru"&&(U.innerHTML=Ue),De=r(l),S=d(l,"DIV",{class:!0});var nt=_(S);u(O.$$.fragment,nt),nt.forEach(n),Ce=r(l),y=d(l,"DIV",{class:!0});var ve=_(y);u(J.$$.fragment,ve),Ee=r(ve),X=d(ve,"P",{"data-svelte-h":!0}),v(X)!=="svelte-189cc7b"&&(X.innerHTML=Se),ve.forEach(n),Ke=r(l),L=d(l,"DIV",{class:!0});var $e=_(L);u(P.$$.fragment,$e),Me=r($e),Y=d($e,"P",{"data-svelte-h":!0}),v(Y)!=="svelte-1f366pl"&&(Y.innerHTML=Xe),$e.forEach(n),Ve=r(l),T=d(l,"DIV",{class:!0});var we=_(T);u(z.$$.fragment,we),ke=r(we),B=d(we,"P",{"data-svelte-h":!0}),v(B)!=="svelte-14bnrb6"&&(B.textContent=Ye),we.forEach(n),Ie=r(l),W=d(l,"DIV",{class:!0});var xe=_(W);u(H.$$.fragment,xe),Oe=r(xe),Q=d(xe,"P",{"data-svelte-h":!0}),v(Q)!=="svelte-1xwrf7t"&&(Q.textContent=Be),xe.forEach(n),Je=r(l),ee=d(l,"DIV",{class:!0});var ot=_(ee);u(Z.$$.fragment,ot),ot.forEach(n),Pe=r(l),A=d(l,"DIV",{class:!0});var ye=_(A);u(G.$$.fragment,ye),ze=r(ye),te=d(ye,"P",{"data-svelte-h":!0}),v(te)!=="svelte-1vrxp2b"&&(te.textContent=Qe),ye.forEach(n),He=r(l),D=d(l,"DIV",{class:!0});var Le=_(D);u(j.$$.fragment,Le),Ze=r(Le),ne=d(Le,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-1un5fcn"&&(ne.textContent=et),Le.forEach(n),l.forEach(n),fe=r(e),u(N.$$.fragment,e),ge=r(e),x=d(e,"DIV",{class:!0});var Te=_(x);u(F.$$.fragment,Te),Ge=r(Te),oe=d(Te,"P",{"data-svelte-h":!0}),v(oe)!=="svelte-18u8upa"&&(oe.textContent=tt),Te.forEach(n),he=r(e),u(q.$$.fragment,e),_e=r(e),ae=d(e,"P",{}),_(ae).forEach(n),this.h()},h(){b(w,"name","hf:doc:metadata"),b(w,"content",ft),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(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(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(T,"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(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(a,"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")},m(e,s){t(document.head,w),c(e,se,s),c(e,re,s),c(e,ie,s),p(C,e,s),c(e,de,s),p(E,e,s),c(e,le,s),c(e,K,s),c(e,ce,s),c(e,M,s),c(e,me,s),p(V,e,s),c(e,ue,s),p(k,e,s),c(e,pe,s),c(e,a,s),p(I,a,null),t(a,We),t(a,R),t(a,Ae),t(a,U),t(a,De),t(a,S),p(O,S,null),t(a,Ce),t(a,y),p(J,y,null),t(y,Ee),t(y,X),t(a,Ke),t(a,L),p(P,L,null),t(L,Me),t(L,Y),t(a,Ve),t(a,T),p(z,T,null),t(T,ke),t(T,B),t(a,Ie),t(a,W),p(H,W,null),t(W,Oe),t(W,Q),t(a,Je),t(a,ee),p(Z,ee,null),t(a,Pe),t(a,A),p(G,A,null),t(A,ze),t(A,te),t(a,He),t(a,D),p(j,D,null),t(D,Ze),t(D,ne),c(e,fe,s),p(N,e,s),c(e,ge,s),c(e,x,s),p(F,x,null),t(x,Ge),t(x,oe),c(e,he,s),p(q,e,s),c(e,_e,s),c(e,ae,s),be=!0},p:at,i(e){be||(f(C.$$.fragment,e),f(E.$$.fragment,e),f(V.$$.fragment,e),f(k.$$.fragment,e),f(I.$$.fragment,e),f(O.$$.fragment,e),f(J.$$.fragment,e),f(P.$$.fragment,e),f(z.$$.fragment,e),f(H.$$.fragment,e),f(Z.$$.fragment,e),f(G.$$.fragment,e),f(j.$$.fragment,e),f(N.$$.fragment,e),f(F.$$.fragment,e),f(q.$$.fragment,e),be=!0)},o(e){g(C.$$.fragment,e),g(E.$$.fragment,e),g(V.$$.fragment,e),g(k.$$.fragment,e),g(I.$$.fragment,e),g(O.$$.fragment,e),g(J.$$.fragment,e),g(P.$$.fragment,e),g(z.$$.fragment,e),g(H.$$.fragment,e),g(Z.$$.fragment,e),g(G.$$.fragment,e),g(j.$$.fragment,e),g(N.$$.fragment,e),g(F.$$.fragment,e),g(q.$$.fragment,e),be=!1},d(e){e&&(n(se),n(re),n(ie),n(de),n(le),n(K),n(ce),n(M),n(me),n(ue),n(pe),n(a),n(fe),n(ge),n(x),n(he),n(_e),n(ae)),n(w),h(C,e),h(E,e),h(V,e),h(k,e),h(I),h(O),h(J),h(P),h(z),h(H),h(Z),h(G),h(j),h(N,e),h(F),h(q,e)}}}const ft='{"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 gt(Ne){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xt extends it{constructor(w){super(),dt(this,w,gt,pt,rt,{})}}export{xt as component};
