import{s as Qe,n as Ye,o as et}from"../chunks/scheduler.8c3d61f6.js";import{S as tt,i as nt,g as a,s as o,r as u,A as ot,h as l,f as n,c as s,j as _,u as m,x as b,k as v,y as t,a as c,v as p,d as f,t as h,w as g}from"../chunks/index.da70eac4.js";import{D as x}from"../chunks/Docstring.6b390b9a.js";import{C as st}from"../chunks/CodeBlock.00a903b3.js";import{H as Oe,E as rt}from"../chunks/EditOnGithub.1e64e623.js";function it(Ne){let $,oe,te,se,D,re,K,He='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/genmoai/models" rel="nofollow">Mochi</a> was introduced in <a href="https://huggingface.co/genmo/mochi-1-preview" rel="nofollow">Mochi 1 Preview</a> by Tsinghua University &amp; ZhipuAI.',ie,C,je="The model can be loaded with the following code snippet.",ae,E,le,I,de,r,V,xe,G,Ue=`A VAE model with KL loss for encoding images into latents and decoding latent representations into images. Used in
<a href="https://github.com/genmoai/models" rel="nofollow">Mochi 1 preview</a>.`,Me,W,Se=`This model inherits from <a href="/docs/diffusers/pr_10021/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).`,ye,R,Z,Te,M,P,Le,F,qe=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ae,y,z,ke,X,Ge=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,De,T,O,Ke,B,We=`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.`,Ce,L,N,Ee,J,Re=`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,A,H,Ve,Q,Fe="Decode a batch of images using a tiled decoder.",Ze,k,j,Pe,Y,Xe="Encode a batch of images using a tiled encoder.",ce,U,ue,w,S,ze,ee,Be="Output of decoding method.",me,q,pe,ne,fe;return D=new Oe({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),E=new st({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xNb2NoaSUwQSUwQXZhZSUyMCUzRCUyMEF1dG9lbmNvZGVyS0xNb2NoaS5mcm9tX3ByZXRyYWluZWQoJTIyZ2VubW8lMkZtb2NoaS0xLXByZXZpZXclMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MzIpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLMochi

vae = AutoencoderKLMochi.from_pretrained(<span class="hljs-string">&quot;genmo/mochi-1-preview&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),I=new Oe({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLMochi",headingTag:"h2"}}),V=new x({props:{name:"class diffusers.AutoencoderKLMochi",anchor:"diffusers.AutoencoderKLMochi",parameters:[{name:"in_channels",val:": int = 15"},{name:"out_channels",val:": int = 3"},{name:"encoder_block_out_channels",val:": typing.Tuple[int] = (64, 128, 256, 384)"},{name:"decoder_block_out_channels",val:": typing.Tuple[int] = (128, 256, 512, 768)"},{name:"latent_channels",val:": int = 12"},{name:"layers_per_block",val:": typing.Tuple[int, ...] = (3, 3, 4, 6, 3)"},{name:"act_fn",val:": str = 'silu'"},{name:"temporal_expansions",val:": typing.Tuple[int, ...] = (1, 2, 3)"},{name:"spatial_expansions",val:": typing.Tuple[int, ...] = (2, 2, 2)"},{name:"add_attention_block",val:": typing.Tuple[bool, ...] = (False, True, True, True, True)"},{name:"latents_mean",val:": typing.Tuple[float, ...] = (-0.06730895953510081, -0.038011381506090416, -0.07477820912866141, -0.05565264470995561, 0.012767231469026969, -0.04703542746246419, 0.043896967884726704, -0.09346305707025976, -0.09918314763016893, -0.008729793427399178, -0.011931556316503654, -0.0321993391887285)"},{name:"latents_std",val:": typing.Tuple[float, ...] = (0.9263795028493863, 0.9248894543193766, 0.9393059390890617, 0.959253732819592, 0.8244560132752793, 0.917259975397747, 0.9294154431013696, 1.3720942357788521, 0.881393668867029, 0.9168315692124348, 0.9185249279345552, 0.9274757570805041)"},{name:"scaling_factor",val:": float = 1.0"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMochi.in_channels",description:"<strong>in_channels</strong> (int, <em>optional</em>, defaults to 3) &#x2014; Number of channels in the input image.",name:"in_channels"},{anchor:"diffusers.AutoencoderKLMochi.out_channels",description:"<strong>out_channels</strong> (int,  <em>optional</em>, defaults to 3) &#x2014; Number of channels in the output.",name:"out_channels"},{anchor:"diffusers.AutoencoderKLMochi.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(64,)</code>) &#x2014;
Tuple of block output channels.`,name:"block_out_channels"},{anchor:"diffusers.AutoencoderKLMochi.act_fn",description:"<strong>act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014; The activation function to use.",name:"act_fn"},{anchor:"diffusers.AutoencoderKLMochi.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1.15258426</code>) &#x2014;
The component-wise standard deviation of the trained latent space computed using the first batch of the
training set. This is used to scale the latent space to have unit variance when training the diffusion
model. The latents are scaled with the formula <code>z = z * scaling_factor</code> before being passed to the
diffusion model. When decoding, the latents are scaled back to the original scale with the formula: <code>z = 1 / scaling_factor * z</code>. For more details, refer to sections 4.3.2 and D.1 of the <a href="https://arxiv.org/abs/2112.10752" rel="nofollow">High-Resolution Image
Synthesis with Latent Diffusion Models</a> paper.`,name:"scaling_factor"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L690"}}),Z=new x({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMochi.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/utils/accelerate_utils.py#L43"}}),P=new x({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLMochi.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L869"}}),z=new x({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLMochi.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L855"}}),O=new x({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLMochi.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L862"}}),N=new x({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMochi.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.AutoencoderKLMochi.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.AutoencoderKLMochi.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.AutoencoderKLMochi.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.AutoencoderKLMochi.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/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L825"}}),H=new x({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLMochi.tiled_decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMochi.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLMochi.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/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1071",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 x({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLMochi.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMochi.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/vr_10021/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1014",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>
`}}),U=new Oe({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),S=new x({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/vr_10021/src/diffusers/models/autoencoders/vae.py#L33"}}),q=new rt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_mochi.md"}}),{c(){$=a("meta"),oe=o(),te=a("p"),se=o(),u(D.$$.fragment),re=o(),K=a("p"),K.innerHTML=He,ie=o(),C=a("p"),C.textContent=je,ae=o(),u(E.$$.fragment),le=o(),u(I.$$.fragment),de=o(),r=a("div"),u(V.$$.fragment),xe=o(),G=a("p"),G.innerHTML=Ue,Me=o(),W=a("p"),W.innerHTML=Se,ye=o(),R=a("div"),u(Z.$$.fragment),Te=o(),M=a("div"),u(P.$$.fragment),Le=o(),F=a("p"),F.innerHTML=qe,Ae=o(),y=a("div"),u(z.$$.fragment),ke=o(),X=a("p"),X.innerHTML=Ge,De=o(),T=a("div"),u(O.$$.fragment),Ke=o(),B=a("p"),B.textContent=We,Ce=o(),L=a("div"),u(N.$$.fragment),Ee=o(),J=a("p"),J.textContent=Re,Ie=o(),A=a("div"),u(H.$$.fragment),Ve=o(),Q=a("p"),Q.textContent=Fe,Ze=o(),k=a("div"),u(j.$$.fragment),Pe=o(),Y=a("p"),Y.textContent=Xe,ce=o(),u(U.$$.fragment),ue=o(),w=a("div"),u(S.$$.fragment),ze=o(),ee=a("p"),ee.textContent=Be,me=o(),u(q.$$.fragment),pe=o(),ne=a("p"),this.h()},l(e){const i=ot("svelte-u9bgzb",document.head);$=l(i,"META",{name:!0,content:!0}),i.forEach(n),oe=s(e),te=l(e,"P",{}),_(te).forEach(n),se=s(e),m(D.$$.fragment,e),re=s(e),K=l(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1jrzq50"&&(K.innerHTML=He),ie=s(e),C=l(e,"P",{"data-svelte-h":!0}),b(C)!=="svelte-1vuni30"&&(C.textContent=je),ae=s(e),m(E.$$.fragment,e),le=s(e),m(I.$$.fragment,e),de=s(e),r=l(e,"DIV",{class:!0});var d=_(r);m(V.$$.fragment,d),xe=s(d),G=l(d,"P",{"data-svelte-h":!0}),b(G)!=="svelte-osx1y"&&(G.innerHTML=Ue),Me=s(d),W=l(d,"P",{"data-svelte-h":!0}),b(W)!=="svelte-4kemio"&&(W.innerHTML=Se),ye=s(d),R=l(d,"DIV",{class:!0});var Je=_(R);m(Z.$$.fragment,Je),Je.forEach(n),Te=s(d),M=l(d,"DIV",{class:!0});var he=_(M);m(P.$$.fragment,he),Le=s(he),F=l(he,"P",{"data-svelte-h":!0}),b(F)!=="svelte-189cc7b"&&(F.innerHTML=qe),he.forEach(n),Ae=s(d),y=l(d,"DIV",{class:!0});var ge=_(y);m(z.$$.fragment,ge),ke=s(ge),X=l(ge,"P",{"data-svelte-h":!0}),b(X)!=="svelte-1f366pl"&&(X.innerHTML=Ge),ge.forEach(n),De=s(d),T=l(d,"DIV",{class:!0});var _e=_(T);m(O.$$.fragment,_e),Ke=s(_e),B=l(_e,"P",{"data-svelte-h":!0}),b(B)!=="svelte-14bnrb6"&&(B.textContent=We),_e.forEach(n),Ce=s(d),L=l(d,"DIV",{class:!0});var be=_(L);m(N.$$.fragment,be),Ee=s(be),J=l(be,"P",{"data-svelte-h":!0}),b(J)!=="svelte-1xwrf7t"&&(J.textContent=Re),be.forEach(n),Ie=s(d),A=l(d,"DIV",{class:!0});var ve=_(A);m(H.$$.fragment,ve),Ve=s(ve),Q=l(ve,"P",{"data-svelte-h":!0}),b(Q)!=="svelte-1vrxp2b"&&(Q.textContent=Fe),ve.forEach(n),Ze=s(d),k=l(d,"DIV",{class:!0});var $e=_(k);m(j.$$.fragment,$e),Pe=s($e),Y=l($e,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-1un5fcn"&&(Y.textContent=Xe),$e.forEach(n),d.forEach(n),ce=s(e),m(U.$$.fragment,e),ue=s(e),w=l(e,"DIV",{class:!0});var we=_(w);m(S.$$.fragment,we),ze=s(we),ee=l(we,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-18u8upa"&&(ee.textContent=Be),we.forEach(n),me=s(e),m(q.$$.fragment,e),pe=s(e),ne=l(e,"P",{}),_(ne).forEach(n),this.h()},h(){v($,"name","hf:doc:metadata"),v($,"content",at),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"),v(T,"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(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(k,"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(w,"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,i){t(document.head,$),c(e,oe,i),c(e,te,i),c(e,se,i),p(D,e,i),c(e,re,i),c(e,K,i),c(e,ie,i),c(e,C,i),c(e,ae,i),p(E,e,i),c(e,le,i),p(I,e,i),c(e,de,i),c(e,r,i),p(V,r,null),t(r,xe),t(r,G),t(r,Me),t(r,W),t(r,ye),t(r,R),p(Z,R,null),t(r,Te),t(r,M),p(P,M,null),t(M,Le),t(M,F),t(r,Ae),t(r,y),p(z,y,null),t(y,ke),t(y,X),t(r,De),t(r,T),p(O,T,null),t(T,Ke),t(T,B),t(r,Ce),t(r,L),p(N,L,null),t(L,Ee),t(L,J),t(r,Ie),t(r,A),p(H,A,null),t(A,Ve),t(A,Q),t(r,Ze),t(r,k),p(j,k,null),t(k,Pe),t(k,Y),c(e,ce,i),p(U,e,i),c(e,ue,i),c(e,w,i),p(S,w,null),t(w,ze),t(w,ee),c(e,me,i),p(q,e,i),c(e,pe,i),c(e,ne,i),fe=!0},p:Ye,i(e){fe||(f(D.$$.fragment,e),f(E.$$.fragment,e),f(I.$$.fragment,e),f(V.$$.fragment,e),f(Z.$$.fragment,e),f(P.$$.fragment,e),f(z.$$.fragment,e),f(O.$$.fragment,e),f(N.$$.fragment,e),f(H.$$.fragment,e),f(j.$$.fragment,e),f(U.$$.fragment,e),f(S.$$.fragment,e),f(q.$$.fragment,e),fe=!0)},o(e){h(D.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(V.$$.fragment,e),h(Z.$$.fragment,e),h(P.$$.fragment,e),h(z.$$.fragment,e),h(O.$$.fragment,e),h(N.$$.fragment,e),h(H.$$.fragment,e),h(j.$$.fragment,e),h(U.$$.fragment,e),h(S.$$.fragment,e),h(q.$$.fragment,e),fe=!1},d(e){e&&(n(oe),n(te),n(se),n(re),n(K),n(ie),n(C),n(ae),n(le),n(de),n(r),n(ce),n(ue),n(w),n(me),n(pe),n(ne)),n($),g(D,e),g(E,e),g(I,e),g(V),g(Z),g(P),g(z),g(O),g(N),g(H),g(j),g(U,e),g(S),g(q,e)}}}const at='{"title":"AutoencoderKLMochi","local":"autoencoderklmochi","sections":[{"title":"AutoencoderKLMochi","local":"diffusers.AutoencoderKLMochi","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function lt(Ne){return et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ft extends tt{constructor($){super(),nt(this,$,lt,it,Qe,{})}}export{ft as component};
