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 m,A as ot,h as l,f as n,c as s,j as _,u,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.28bd4ce5.js";import{C as st}from"../chunks/CodeBlock.a9c4becf.js";import{H as Oe,E as it}from"../chunks/getInferenceSnippets.cd165132.js";function rt(Ne){let $,oe,te,se,k,ie,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.',re,C,je="The model can be loaded with the following code snippet.",ae,E,le,I,de,i,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/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).`,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,De,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.`,ke,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,D,j,Pe,Y,Xe="Encode a batch of images using a tiled encoder.",ce,U,me,w,S,ze,ee,Be="Output of decoding method.",ue,q,pe,ne,fe;return k=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://huggingface.co/papers/2112.10752" rel="nofollow">High-Resolution Image
Synthesis with Latent Diffusion Models</a> paper.`,name:"scaling_factor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L660"}}),Z=new x({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMochi.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/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/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L835"}}),z=new x({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLMochi.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L821"}}),O=new x({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLMochi.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L828"}}),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/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L791"}}),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/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1037",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/main/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L980",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/main/src/diffusers/models/autoencoders/vae.py#L47"}}),q=new it({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(),m(k.$$.fragment),ie=o(),K=a("p"),K.innerHTML=He,re=o(),C=a("p"),C.textContent=je,ae=o(),m(E.$$.fragment),le=o(),m(I.$$.fragment),de=o(),i=a("div"),m(V.$$.fragment),xe=o(),G=a("p"),G.innerHTML=Ue,Me=o(),W=a("p"),W.innerHTML=Se,ye=o(),R=a("div"),m(Z.$$.fragment),Te=o(),M=a("div"),m(P.$$.fragment),Le=o(),F=a("p"),F.innerHTML=qe,Ae=o(),y=a("div"),m(z.$$.fragment),De=o(),X=a("p"),X.innerHTML=Ge,ke=o(),T=a("div"),m(O.$$.fragment),Ke=o(),B=a("p"),B.textContent=We,Ce=o(),L=a("div"),m(N.$$.fragment),Ee=o(),J=a("p"),J.textContent=Re,Ie=o(),A=a("div"),m(H.$$.fragment),Ve=o(),Q=a("p"),Q.textContent=Fe,Ze=o(),D=a("div"),m(j.$$.fragment),Pe=o(),Y=a("p"),Y.textContent=Xe,ce=o(),m(U.$$.fragment),me=o(),w=a("div"),m(S.$$.fragment),ze=o(),ee=a("p"),ee.textContent=Be,ue=o(),m(q.$$.fragment),pe=o(),ne=a("p"),this.h()},l(e){const r=ot("svelte-u9bgzb",document.head);$=l(r,"META",{name:!0,content:!0}),r.forEach(n),oe=s(e),te=l(e,"P",{}),_(te).forEach(n),se=s(e),u(k.$$.fragment,e),ie=s(e),K=l(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1jrzq50"&&(K.innerHTML=He),re=s(e),C=l(e,"P",{"data-svelte-h":!0}),b(C)!=="svelte-1vuni30"&&(C.textContent=je),ae=s(e),u(E.$$.fragment,e),le=s(e),u(I.$$.fragment,e),de=s(e),i=l(e,"DIV",{class:!0});var d=_(i);u(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-1hyu2ru"&&(W.innerHTML=Se),ye=s(d),R=l(d,"DIV",{class:!0});var Je=_(R);u(Z.$$.fragment,Je),Je.forEach(n),Te=s(d),M=l(d,"DIV",{class:!0});var he=_(M);u(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);u(z.$$.fragment,ge),De=s(ge),X=l(ge,"P",{"data-svelte-h":!0}),b(X)!=="svelte-1f366pl"&&(X.innerHTML=Ge),ge.forEach(n),ke=s(d),T=l(d,"DIV",{class:!0});var _e=_(T);u(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);u(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);u(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),D=l(d,"DIV",{class:!0});var $e=_(D);u(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),u(U.$$.fragment,e),me=s(e),w=l(e,"DIV",{class:!0});var we=_(w);u(S.$$.fragment,we),ze=s(we),ee=l(we,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-18u8upa"&&(ee.textContent=Be),we.forEach(n),ue=s(e),u(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(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(i,"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,r){t(document.head,$),c(e,oe,r),c(e,te,r),c(e,se,r),p(k,e,r),c(e,ie,r),c(e,K,r),c(e,re,r),c(e,C,r),c(e,ae,r),p(E,e,r),c(e,le,r),p(I,e,r),c(e,de,r),c(e,i,r),p(V,i,null),t(i,xe),t(i,G),t(i,Me),t(i,W),t(i,ye),t(i,R),p(Z,R,null),t(i,Te),t(i,M),p(P,M,null),t(M,Le),t(M,F),t(i,Ae),t(i,y),p(z,y,null),t(y,De),t(y,X),t(i,ke),t(i,T),p(O,T,null),t(T,Ke),t(T,B),t(i,Ce),t(i,L),p(N,L,null),t(L,Ee),t(L,J),t(i,Ie),t(i,A),p(H,A,null),t(A,Ve),t(A,Q),t(i,Ze),t(i,D),p(j,D,null),t(D,Pe),t(D,Y),c(e,ce,r),p(U,e,r),c(e,me,r),c(e,w,r),p(S,w,null),t(w,ze),t(w,ee),c(e,ue,r),p(q,e,r),c(e,pe,r),c(e,ne,r),fe=!0},p:Ye,i(e){fe||(f(k.$$.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(k.$$.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(ie),n(K),n(re),n(C),n(ae),n(le),n(de),n(i),n(ce),n(me),n(w),n(ue),n(pe),n(ne)),n($),g(k,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,rt,Qe,{})}}export{ft as component};
