import{s as tt,n as nt,o as ot}from"../chunks/scheduler.8c3d61f6.js";import{S as at,i as st,g as i,s as a,r as u,A as rt,h as l,f as t,c as s,j as _,u as c,x as b,k as v,y as n,a as m,v as p,d as g,t as f,w as h}from"../chunks/index.da70eac4.js";import{D as $}from"../chunks/Docstring.6b390b9a.js";import{C as it}from"../chunks/CodeBlock.00a903b3.js";import{H as xe,E as lt}from"../chunks/EditOnGithub.1e64e623.js";function dt(Ue){let w,se,oe,re,T,ie,k,Ge='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/aigc-apps/EasyAnimate" rel="nofollow">EasyAnimate</a> was introduced by Alibaba PAI.',le,E,Ne="The model can be loaded with the following code snippet.",de,K,me,C,ue,r,O,Ae,q,We=`A VAE model with KL loss for encoding images into latents and decoding latent representations into images. This
model is used in <a href="https://arxiv.org/abs/2405.18991" rel="nofollow">EasyAnimate</a>.`,De,R,Ze=`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).`,Te,F,V,ke,J,j,Ee,L,I,Ke,z,qe=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ce,x,P,Oe,Y,Re=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ve,A,H,je,X,Fe=`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,D,S,Pe,Q,Je=`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.`,He,ee,B,ce,U,pe,M,G,Se,te,ze="Output of AutoencoderKL encoding method.",ge,N,fe,y,W,Be,ne,Ye="Output of decoding method.",he,Z,_e,ae,ve;return T=new xe({props:{title:"AutoencoderKLMagvit",local:"autoencoderklmagvit",headingTag:"h1"}}),K=new it({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xNYWd2aXQlMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMTWFndml0LmZyb21fcHJldHJhaW5lZCglMjJhbGliYWJhLXBhaSUyRkVhc3lBbmltYXRlVjUuMS0xMmItemglMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMagvit

vae = AutoencoderKLMagvit.from_pretrained(<span class="hljs-string">&quot;alibaba-pai/EasyAnimateV5.1-12b-zh&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),C=new xe({props:{title:"AutoencoderKLMagvit",local:"diffusers.AutoencoderKLMagvit",headingTag:"h2"}}),O=new $({props:{name:"class diffusers.AutoencoderKLMagvit",anchor:"diffusers.AutoencoderKLMagvit",parameters:[{name:"in_channels",val:": int = 3"},{name:"latent_channels",val:": int = 16"},{name:"out_channels",val:": int = 3"},{name:"block_out_channels",val:": typing.Tuple[int, ...] = [128, 256, 512, 512]"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ['SpatialDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D', 'SpatialTemporalDownBlock3D']"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ['SpatialUpBlock3D', 'SpatialTemporalUpBlock3D', 'SpatialTemporalUpBlock3D', 'SpatialTemporalUpBlock3D']"},{name:"layers_per_block",val:": int = 2"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_num_groups",val:": int = 32"},{name:"scaling_factor",val:": float = 0.7125"},{name:"spatial_group_norm",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L666"}}),V=new $({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.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:"wrapper",anchor:"diffusers.AutoencoderKLMagvit.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),I=new $({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLMagvit.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L822"}}),P=new $({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLMagvit.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L808"}}),H=new $({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLMagvit.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_magvit.py#L815"}}),S=new $({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMagvit.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_min_num_frames",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"},{name:"tile_sample_stride_num_frames",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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.AutoencoderKLMagvit.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_magvit.py#L772"}}),B=new $({props:{name:"forward",anchor:"diffusers.AutoencoderKLMagvit.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.AutoencoderKLMagvit.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLMagvit.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLMagvit.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_magvit.py#L1068"}}),U=new xe({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),G=new $({props:{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput.latent_dist",description:`<strong>latent_dist</strong> (<code>DiagonalGaussianDistribution</code>) &#x2014;
Encoded outputs of <code>Encoder</code> represented as the mean and logvar of <code>DiagonalGaussianDistribution</code>.
<code>DiagonalGaussianDistribution</code> allows for sampling latents from the distribution.`,name:"latent_dist"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_outputs.py#L6"}}),N=new xe({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),W=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"}}),Z=new lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_magvit.md"}}),{c(){w=i("meta"),se=a(),oe=i("p"),re=a(),u(T.$$.fragment),ie=a(),k=i("p"),k.innerHTML=Ge,le=a(),E=i("p"),E.textContent=Ne,de=a(),u(K.$$.fragment),me=a(),u(C.$$.fragment),ue=a(),r=i("div"),u(O.$$.fragment),Ae=a(),q=i("p"),q.innerHTML=We,De=a(),R=i("p"),R.innerHTML=Ze,Te=a(),F=i("div"),u(V.$$.fragment),ke=a(),J=i("div"),u(j.$$.fragment),Ee=a(),L=i("div"),u(I.$$.fragment),Ke=a(),z=i("p"),z.innerHTML=qe,Ce=a(),x=i("div"),u(P.$$.fragment),Oe=a(),Y=i("p"),Y.innerHTML=Re,Ve=a(),A=i("div"),u(H.$$.fragment),je=a(),X=i("p"),X.textContent=Fe,Ie=a(),D=i("div"),u(S.$$.fragment),Pe=a(),Q=i("p"),Q.textContent=Je,He=a(),ee=i("div"),u(B.$$.fragment),ce=a(),u(U.$$.fragment),pe=a(),M=i("div"),u(G.$$.fragment),Se=a(),te=i("p"),te.textContent=ze,ge=a(),u(N.$$.fragment),fe=a(),y=i("div"),u(W.$$.fragment),Be=a(),ne=i("p"),ne.textContent=Ye,he=a(),u(Z.$$.fragment),_e=a(),ae=i("p"),this.h()},l(e){const o=rt("svelte-u9bgzb",document.head);w=l(o,"META",{name:!0,content:!0}),o.forEach(t),se=s(e),oe=l(e,"P",{}),_(oe).forEach(t),re=s(e),c(T.$$.fragment,e),ie=s(e),k=l(e,"P",{"data-svelte-h":!0}),b(k)!=="svelte-9t4ux3"&&(k.innerHTML=Ge),le=s(e),E=l(e,"P",{"data-svelte-h":!0}),b(E)!=="svelte-1vuni30"&&(E.textContent=Ne),de=s(e),c(K.$$.fragment,e),me=s(e),c(C.$$.fragment,e),ue=s(e),r=l(e,"DIV",{class:!0});var d=_(r);c(O.$$.fragment,d),Ae=s(d),q=l(d,"P",{"data-svelte-h":!0}),b(q)!=="svelte-19nja0q"&&(q.innerHTML=We),De=s(d),R=l(d,"P",{"data-svelte-h":!0}),b(R)!=="svelte-1hyu2ru"&&(R.innerHTML=Ze),Te=s(d),F=l(d,"DIV",{class:!0});var Xe=_(F);c(V.$$.fragment,Xe),Xe.forEach(t),ke=s(d),J=l(d,"DIV",{class:!0});var Qe=_(J);c(j.$$.fragment,Qe),Qe.forEach(t),Ee=s(d),L=l(d,"DIV",{class:!0});var be=_(L);c(I.$$.fragment,be),Ke=s(be),z=l(be,"P",{"data-svelte-h":!0}),b(z)!=="svelte-189cc7b"&&(z.innerHTML=qe),be.forEach(t),Ce=s(d),x=l(d,"DIV",{class:!0});var $e=_(x);c(P.$$.fragment,$e),Oe=s($e),Y=l($e,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-1f366pl"&&(Y.innerHTML=Re),$e.forEach(t),Ve=s(d),A=l(d,"DIV",{class:!0});var we=_(A);c(H.$$.fragment,we),je=s(we),X=l(we,"P",{"data-svelte-h":!0}),b(X)!=="svelte-14bnrb6"&&(X.textContent=Fe),we.forEach(t),Ie=s(d),D=l(d,"DIV",{class:!0});var Me=_(D);c(S.$$.fragment,Me),Pe=s(Me),Q=l(Me,"P",{"data-svelte-h":!0}),b(Q)!=="svelte-1xwrf7t"&&(Q.textContent=Je),Me.forEach(t),He=s(d),ee=l(d,"DIV",{class:!0});var et=_(ee);c(B.$$.fragment,et),et.forEach(t),d.forEach(t),ce=s(e),c(U.$$.fragment,e),pe=s(e),M=l(e,"DIV",{class:!0});var ye=_(M);c(G.$$.fragment,ye),Se=s(ye),te=l(ye,"P",{"data-svelte-h":!0}),b(te)!=="svelte-1vsc7ag"&&(te.textContent=ze),ye.forEach(t),ge=s(e),c(N.$$.fragment,e),fe=s(e),y=l(e,"DIV",{class:!0});var Le=_(y);c(W.$$.fragment,Le),Be=s(Le),ne=l(Le,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-18u8upa"&&(ne.textContent=Ye),Le.forEach(t),he=s(e),c(Z.$$.fragment,e),_e=s(e),ae=l(e,"P",{}),_(ae).forEach(t),this.h()},h(){v(w,"name","hf:doc:metadata"),v(w,"content",mt),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(y,"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,o){n(document.head,w),m(e,se,o),m(e,oe,o),m(e,re,o),p(T,e,o),m(e,ie,o),m(e,k,o),m(e,le,o),m(e,E,o),m(e,de,o),p(K,e,o),m(e,me,o),p(C,e,o),m(e,ue,o),m(e,r,o),p(O,r,null),n(r,Ae),n(r,q),n(r,De),n(r,R),n(r,Te),n(r,F),p(V,F,null),n(r,ke),n(r,J),p(j,J,null),n(r,Ee),n(r,L),p(I,L,null),n(L,Ke),n(L,z),n(r,Ce),n(r,x),p(P,x,null),n(x,Oe),n(x,Y),n(r,Ve),n(r,A),p(H,A,null),n(A,je),n(A,X),n(r,Ie),n(r,D),p(S,D,null),n(D,Pe),n(D,Q),n(r,He),n(r,ee),p(B,ee,null),m(e,ce,o),p(U,e,o),m(e,pe,o),m(e,M,o),p(G,M,null),n(M,Se),n(M,te),m(e,ge,o),p(N,e,o),m(e,fe,o),m(e,y,o),p(W,y,null),n(y,Be),n(y,ne),m(e,he,o),p(Z,e,o),m(e,_e,o),m(e,ae,o),ve=!0},p:nt,i(e){ve||(g(T.$$.fragment,e),g(K.$$.fragment,e),g(C.$$.fragment,e),g(O.$$.fragment,e),g(V.$$.fragment,e),g(j.$$.fragment,e),g(I.$$.fragment,e),g(P.$$.fragment,e),g(H.$$.fragment,e),g(S.$$.fragment,e),g(B.$$.fragment,e),g(U.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(W.$$.fragment,e),g(Z.$$.fragment,e),ve=!0)},o(e){f(T.$$.fragment,e),f(K.$$.fragment,e),f(C.$$.fragment,e),f(O.$$.fragment,e),f(V.$$.fragment,e),f(j.$$.fragment,e),f(I.$$.fragment,e),f(P.$$.fragment,e),f(H.$$.fragment,e),f(S.$$.fragment,e),f(B.$$.fragment,e),f(U.$$.fragment,e),f(G.$$.fragment,e),f(N.$$.fragment,e),f(W.$$.fragment,e),f(Z.$$.fragment,e),ve=!1},d(e){e&&(t(se),t(oe),t(re),t(ie),t(k),t(le),t(E),t(de),t(me),t(ue),t(r),t(ce),t(pe),t(M),t(ge),t(fe),t(y),t(he),t(_e),t(ae)),t(w),h(T,e),h(K,e),h(C,e),h(O),h(V),h(j),h(I),h(P),h(H),h(S),h(B),h(U,e),h(G),h(N,e),h(W),h(Z,e)}}}const mt='{"title":"AutoencoderKLMagvit","local":"autoencoderklmagvit","sections":[{"title":"AutoencoderKLMagvit","local":"diffusers.AutoencoderKLMagvit","sections":[],"depth":2},{"title":"AutoencoderKLOutput","local":"diffusers.models.modeling_outputs.AutoencoderKLOutput","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function ut(Ue){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends at{constructor(w){super(),st(this,w,ut,dt,tt,{})}}export{_t as component};
