import{s as nt,n as ot,o as rt}from"../chunks/scheduler.8c3d61f6.js";import{S as st,i as at,g as i,s as o,r as m,A as it,h as d,f as n,c as r,j as _,u,x as v,k as b,y as t,a as c,v as p,d as f,t as g,w as h}from"../chunks/index.da70eac4.js";import{D as $}from"../chunks/Docstring.932cdff3.js";import{C as dt}from"../chunks/CodeBlock.a9c4becf.js";import{H as Ge,E as lt}from"../chunks/index.ef90fe87.js";function ct(je){let w,se,oe,ae,E,ie,C,ze='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.',de,K,Ne="The model can be loaded with the following code snippet.",le,M,ce,V,me,s,k,Te,F,qe=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.
Introduced in [Wan 2.1].`,Le,R,Fe=`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).`,We,U,I,Ae,y,O,De,S,Re=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ee,T,J,Ce,X,Ue=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ke,L,P,Me,Y,Se=`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.`,Ve,W,H,ke,B,Xe=`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.`,Ie,Q,Z,Oe,A,G,Je,ee,Ye="Decode a batch of images using a tiled decoder.",Pe,D,j,He,te,Be="Encode a batch of images using a tiled encoder.",ue,z,pe,x,N,Ze,ne,Qe="Output of decoding method.",fe,q,ge,re,he;return E=new Ge({props:{title:"AutoencoderKLWan",local:"autoencoderklwan",headingTag:"h1"}}),M=new dt({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}}),V=new Ge({props:{title:"AutoencoderKLWan",local:"diffusers.AutoencoderKLWan",headingTag:"h2"}}),k=new $({props:{name:"class diffusers.AutoencoderKLWan",anchor:"diffusers.AutoencoderKLWan",parameters:[{name:"base_dim",val:": int = 96"},{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]"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L659"}}),I=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"}}),O=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#L796"}}),J=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#L782"}}),P=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#L789"}}),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#L752"}}),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#L1065"}}),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#L1002",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#L936",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>
`}}),z=new Ge({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),N=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#L46"}}),q=new lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_wan.md"}}),{c(){w=i("meta"),se=o(),oe=i("p"),ae=o(),m(E.$$.fragment),ie=o(),C=i("p"),C.innerHTML=ze,de=o(),K=i("p"),K.textContent=Ne,le=o(),m(M.$$.fragment),ce=o(),m(V.$$.fragment),me=o(),s=i("div"),m(k.$$.fragment),Te=o(),F=i("p"),F.textContent=qe,Le=o(),R=i("p"),R.innerHTML=Fe,We=o(),U=i("div"),m(I.$$.fragment),Ae=o(),y=i("div"),m(O.$$.fragment),De=o(),S=i("p"),S.innerHTML=Re,Ee=o(),T=i("div"),m(J.$$.fragment),Ce=o(),X=i("p"),X.innerHTML=Ue,Ke=o(),L=i("div"),m(P.$$.fragment),Me=o(),Y=i("p"),Y.textContent=Se,Ve=o(),W=i("div"),m(H.$$.fragment),ke=o(),B=i("p"),B.textContent=Xe,Ie=o(),Q=i("div"),m(Z.$$.fragment),Oe=o(),A=i("div"),m(G.$$.fragment),Je=o(),ee=i("p"),ee.textContent=Ye,Pe=o(),D=i("div"),m(j.$$.fragment),He=o(),te=i("p"),te.textContent=Be,ue=o(),m(z.$$.fragment),pe=o(),x=i("div"),m(N.$$.fragment),Ze=o(),ne=i("p"),ne.textContent=Qe,fe=o(),m(q.$$.fragment),ge=o(),re=i("p"),this.h()},l(e){const a=it("svelte-u9bgzb",document.head);w=d(a,"META",{name:!0,content:!0}),a.forEach(n),se=r(e),oe=d(e,"P",{}),_(oe).forEach(n),ae=r(e),u(E.$$.fragment,e),ie=r(e),C=d(e,"P",{"data-svelte-h":!0}),v(C)!=="svelte-tl45xs"&&(C.innerHTML=ze),de=r(e),K=d(e,"P",{"data-svelte-h":!0}),v(K)!=="svelte-1vuni30"&&(K.textContent=Ne),le=r(e),u(M.$$.fragment,e),ce=r(e),u(V.$$.fragment,e),me=r(e),s=d(e,"DIV",{class:!0});var l=_(s);u(k.$$.fragment,l),Te=r(l),F=d(l,"P",{"data-svelte-h":!0}),v(F)!=="svelte-1cxmnva"&&(F.textContent=qe),Le=r(l),R=d(l,"P",{"data-svelte-h":!0}),v(R)!=="svelte-1hyu2ru"&&(R.innerHTML=Fe),We=r(l),U=d(l,"DIV",{class:!0});var et=_(U);u(I.$$.fragment,et),et.forEach(n),Ae=r(l),y=d(l,"DIV",{class:!0});var _e=_(y);u(O.$$.fragment,_e),De=r(_e),S=d(_e,"P",{"data-svelte-h":!0}),v(S)!=="svelte-189cc7b"&&(S.innerHTML=Re),_e.forEach(n),Ee=r(l),T=d(l,"DIV",{class:!0});var be=_(T);u(J.$$.fragment,be),Ce=r(be),X=d(be,"P",{"data-svelte-h":!0}),v(X)!=="svelte-1f366pl"&&(X.innerHTML=Ue),be.forEach(n),Ke=r(l),L=d(l,"DIV",{class:!0});var ve=_(L);u(P.$$.fragment,ve),Me=r(ve),Y=d(ve,"P",{"data-svelte-h":!0}),v(Y)!=="svelte-14bnrb6"&&(Y.textContent=Se),ve.forEach(n),Ve=r(l),W=d(l,"DIV",{class:!0});var $e=_(W);u(H.$$.fragment,$e),ke=r($e),B=d($e,"P",{"data-svelte-h":!0}),v(B)!=="svelte-1xwrf7t"&&(B.textContent=Xe),$e.forEach(n),Ie=r(l),Q=d(l,"DIV",{class:!0});var tt=_(Q);u(Z.$$.fragment,tt),tt.forEach(n),Oe=r(l),A=d(l,"DIV",{class:!0});var we=_(A);u(G.$$.fragment,we),Je=r(we),ee=d(we,"P",{"data-svelte-h":!0}),v(ee)!=="svelte-1vrxp2b"&&(ee.textContent=Ye),we.forEach(n),Pe=r(l),D=d(l,"DIV",{class:!0});var xe=_(D);u(j.$$.fragment,xe),He=r(xe),te=d(xe,"P",{"data-svelte-h":!0}),v(te)!=="svelte-1un5fcn"&&(te.textContent=Be),xe.forEach(n),l.forEach(n),ue=r(e),u(z.$$.fragment,e),pe=r(e),x=d(e,"DIV",{class:!0});var ye=_(x);u(N.$$.fragment,ye),Ze=r(ye),ne=d(ye,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-18u8upa"&&(ne.textContent=Qe),ye.forEach(n),fe=r(e),u(q.$$.fragment,e),ge=r(e),re=d(e,"P",{}),_(re).forEach(n),this.h()},h(){b(w,"name","hf:doc:metadata"),b(w,"content",mt),b(U,"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(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(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(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(Q,"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(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(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,a){t(document.head,w),c(e,se,a),c(e,oe,a),c(e,ae,a),p(E,e,a),c(e,ie,a),c(e,C,a),c(e,de,a),c(e,K,a),c(e,le,a),p(M,e,a),c(e,ce,a),p(V,e,a),c(e,me,a),c(e,s,a),p(k,s,null),t(s,Te),t(s,F),t(s,Le),t(s,R),t(s,We),t(s,U),p(I,U,null),t(s,Ae),t(s,y),p(O,y,null),t(y,De),t(y,S),t(s,Ee),t(s,T),p(J,T,null),t(T,Ce),t(T,X),t(s,Ke),t(s,L),p(P,L,null),t(L,Me),t(L,Y),t(s,Ve),t(s,W),p(H,W,null),t(W,ke),t(W,B),t(s,Ie),t(s,Q),p(Z,Q,null),t(s,Oe),t(s,A),p(G,A,null),t(A,Je),t(A,ee),t(s,Pe),t(s,D),p(j,D,null),t(D,He),t(D,te),c(e,ue,a),p(z,e,a),c(e,pe,a),c(e,x,a),p(N,x,null),t(x,Ze),t(x,ne),c(e,fe,a),p(q,e,a),c(e,ge,a),c(e,re,a),he=!0},p:ot,i(e){he||(f(E.$$.fragment,e),f(M.$$.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(H.$$.fragment,e),f(Z.$$.fragment,e),f(G.$$.fragment,e),f(j.$$.fragment,e),f(z.$$.fragment,e),f(N.$$.fragment,e),f(q.$$.fragment,e),he=!0)},o(e){g(E.$$.fragment,e),g(M.$$.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(H.$$.fragment,e),g(Z.$$.fragment,e),g(G.$$.fragment,e),g(j.$$.fragment,e),g(z.$$.fragment,e),g(N.$$.fragment,e),g(q.$$.fragment,e),he=!1},d(e){e&&(n(se),n(oe),n(ae),n(ie),n(C),n(de),n(K),n(le),n(ce),n(me),n(s),n(ue),n(pe),n(x),n(fe),n(ge),n(re)),n(w),h(E,e),h(M,e),h(V,e),h(k),h(I),h(O),h(J),h(P),h(H),h(Z),h(G),h(j),h(z,e),h(N),h(q,e)}}}const mt='{"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 ut(je){return rt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bt extends st{constructor(w){super(),at(this,w,ut,ct,nt,{})}}export{bt as component};
