import{s as et,n as tt,o as nt}from"../chunks/scheduler.53228c21.js";import{S as ot,i as it,e as a,s as o,c as m,h as st,a as l,d as n,b as i,f as _,g as u,j as b,k as v,l as t,m as c,n as p,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as rt}from"../chunks/CopyLLMTxtMenu.4f0519ef.js";import{D as w}from"../chunks/Docstring.d02a9fa5.js";import{C as at}from"../chunks/CodeBlock.d30a6509.js";import{H as He,E as lt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function dt(je){let $,ie,ne,se,k,re,C,ae,K,Se='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.',le,E,Ue="The model can be loaded with the following code snippet.",de,I,ce,V,me,r,Z,ye,W,qe=`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>.`,Te,R,Ge=`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).`,Le,F,z,Ae,M,P,De,X,We=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,ke,y,O,Ce,B,Re=`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,N,Ee,J,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,L,H,Ve,Q,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.`,Ze,A,j,ze,Y,Be="Decode a batch of images using a tiled decoder.",Pe,D,S,Oe,ee,Je="Encode a batch of images using a tiled encoder.",ue,U,pe,x,q,Ne,te,Qe="Output of decoding method.",fe,G,he,oe,ge;return k=new rt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),C=new He({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),I=new at({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}}),V=new He({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLMochi",headingTag:"h2"}}),Z=new w({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 w({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 w({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"}}),O=new w({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"}}),N=new w({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"}}),H=new w({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"}}),j=new w({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>
`}}),S=new w({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 He({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),q=new w({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"}}),G=new lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_mochi.md"}}),{c(){$=a("meta"),ie=o(),ne=a("p"),se=o(),m(k.$$.fragment),re=o(),m(C.$$.fragment),ae=o(),K=a("p"),K.innerHTML=Se,le=o(),E=a("p"),E.textContent=Ue,de=o(),m(I.$$.fragment),ce=o(),m(V.$$.fragment),me=o(),r=a("div"),m(Z.$$.fragment),ye=o(),W=a("p"),W.innerHTML=qe,Te=o(),R=a("p"),R.innerHTML=Ge,Le=o(),F=a("div"),m(z.$$.fragment),Ae=o(),M=a("div"),m(P.$$.fragment),De=o(),X=a("p"),X.innerHTML=We,ke=o(),y=a("div"),m(O.$$.fragment),Ce=o(),B=a("p"),B.innerHTML=Re,Ke=o(),T=a("div"),m(N.$$.fragment),Ee=o(),J=a("p"),J.textContent=Fe,Ie=o(),L=a("div"),m(H.$$.fragment),Ve=o(),Q=a("p"),Q.textContent=Xe,Ze=o(),A=a("div"),m(j.$$.fragment),ze=o(),Y=a("p"),Y.textContent=Be,Pe=o(),D=a("div"),m(S.$$.fragment),Oe=o(),ee=a("p"),ee.textContent=Je,ue=o(),m(U.$$.fragment),pe=o(),x=a("div"),m(q.$$.fragment),Ne=o(),te=a("p"),te.textContent=Qe,fe=o(),m(G.$$.fragment),he=o(),oe=a("p"),this.h()},l(e){const s=st("svelte-u9bgzb",document.head);$=l(s,"META",{name:!0,content:!0}),s.forEach(n),ie=i(e),ne=l(e,"P",{}),_(ne).forEach(n),se=i(e),u(k.$$.fragment,e),re=i(e),u(C.$$.fragment,e),ae=i(e),K=l(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1jrzq50"&&(K.innerHTML=Se),le=i(e),E=l(e,"P",{"data-svelte-h":!0}),b(E)!=="svelte-1vuni30"&&(E.textContent=Ue),de=i(e),u(I.$$.fragment,e),ce=i(e),u(V.$$.fragment,e),me=i(e),r=l(e,"DIV",{class:!0});var d=_(r);u(Z.$$.fragment,d),ye=i(d),W=l(d,"P",{"data-svelte-h":!0}),b(W)!=="svelte-osx1y"&&(W.innerHTML=qe),Te=i(d),R=l(d,"P",{"data-svelte-h":!0}),b(R)!=="svelte-1hyu2ru"&&(R.innerHTML=Ge),Le=i(d),F=l(d,"DIV",{class:!0});var Ye=_(F);u(z.$$.fragment,Ye),Ye.forEach(n),Ae=i(d),M=l(d,"DIV",{class:!0});var _e=_(M);u(P.$$.fragment,_e),De=i(_e),X=l(_e,"P",{"data-svelte-h":!0}),b(X)!=="svelte-189cc7b"&&(X.innerHTML=We),_e.forEach(n),ke=i(d),y=l(d,"DIV",{class:!0});var be=_(y);u(O.$$.fragment,be),Ce=i(be),B=l(be,"P",{"data-svelte-h":!0}),b(B)!=="svelte-1f366pl"&&(B.innerHTML=Re),be.forEach(n),Ke=i(d),T=l(d,"DIV",{class:!0});var ve=_(T);u(N.$$.fragment,ve),Ee=i(ve),J=l(ve,"P",{"data-svelte-h":!0}),b(J)!=="svelte-14bnrb6"&&(J.textContent=Fe),ve.forEach(n),Ie=i(d),L=l(d,"DIV",{class:!0});var $e=_(L);u(H.$$.fragment,$e),Ve=i($e),Q=l($e,"P",{"data-svelte-h":!0}),b(Q)!=="svelte-1xwrf7t"&&(Q.textContent=Xe),$e.forEach(n),Ze=i(d),A=l(d,"DIV",{class:!0});var xe=_(A);u(j.$$.fragment,xe),ze=i(xe),Y=l(xe,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-1vrxp2b"&&(Y.textContent=Be),xe.forEach(n),Pe=i(d),D=l(d,"DIV",{class:!0});var we=_(D);u(S.$$.fragment,we),Oe=i(we),ee=l(we,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-1un5fcn"&&(ee.textContent=Je),we.forEach(n),d.forEach(n),ue=i(e),u(U.$$.fragment,e),pe=i(e),x=l(e,"DIV",{class:!0});var Me=_(x);u(q.$$.fragment,Me),Ne=i(Me),te=l(Me,"P",{"data-svelte-h":!0}),b(te)!=="svelte-18u8upa"&&(te.textContent=Qe),Me.forEach(n),fe=i(e),u(G.$$.fragment,e),he=i(e),oe=l(e,"P",{}),_(oe).forEach(n),this.h()},h(){v($,"name","hf:doc:metadata"),v($,"content",ct),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(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(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(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,$),c(e,ie,s),c(e,ne,s),c(e,se,s),p(k,e,s),c(e,re,s),p(C,e,s),c(e,ae,s),c(e,K,s),c(e,le,s),c(e,E,s),c(e,de,s),p(I,e,s),c(e,ce,s),p(V,e,s),c(e,me,s),c(e,r,s),p(Z,r,null),t(r,ye),t(r,W),t(r,Te),t(r,R),t(r,Le),t(r,F),p(z,F,null),t(r,Ae),t(r,M),p(P,M,null),t(M,De),t(M,X),t(r,ke),t(r,y),p(O,y,null),t(y,Ce),t(y,B),t(r,Ke),t(r,T),p(N,T,null),t(T,Ee),t(T,J),t(r,Ie),t(r,L),p(H,L,null),t(L,Ve),t(L,Q),t(r,Ze),t(r,A),p(j,A,null),t(A,ze),t(A,Y),t(r,Pe),t(r,D),p(S,D,null),t(D,Oe),t(D,ee),c(e,ue,s),p(U,e,s),c(e,pe,s),c(e,x,s),p(q,x,null),t(x,Ne),t(x,te),c(e,fe,s),p(G,e,s),c(e,he,s),c(e,oe,s),ge=!0},p:tt,i(e){ge||(f(k.$$.fragment,e),f(C.$$.fragment,e),f(I.$$.fragment,e),f(V.$$.fragment,e),f(Z.$$.fragment,e),f(z.$$.fragment,e),f(P.$$.fragment,e),f(O.$$.fragment,e),f(N.$$.fragment,e),f(H.$$.fragment,e),f(j.$$.fragment,e),f(S.$$.fragment,e),f(U.$$.fragment,e),f(q.$$.fragment,e),f(G.$$.fragment,e),ge=!0)},o(e){h(k.$$.fragment,e),h(C.$$.fragment,e),h(I.$$.fragment,e),h(V.$$.fragment,e),h(Z.$$.fragment,e),h(z.$$.fragment,e),h(P.$$.fragment,e),h(O.$$.fragment,e),h(N.$$.fragment,e),h(H.$$.fragment,e),h(j.$$.fragment,e),h(S.$$.fragment,e),h(U.$$.fragment,e),h(q.$$.fragment,e),h(G.$$.fragment,e),ge=!1},d(e){e&&(n(ie),n(ne),n(se),n(re),n(ae),n(K),n(le),n(E),n(de),n(ce),n(me),n(r),n(ue),n(pe),n(x),n(fe),n(he),n(oe)),n($),g(k,e),g(C,e),g(I,e),g(V,e),g(Z),g(z),g(P),g(O),g(N),g(H),g(j),g(S),g(U,e),g(q),g(G,e)}}}const ct='{"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 mt(je){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bt extends ot{constructor($){super(),it(this,$,mt,dt,et,{})}}export{bt as component};
