import{s as Ze,n as ze,o as Ie}from"../chunks/scheduler.53228c21.js";import{S as Oe,i as Ne,e as l,s as o,c as m,h as Pe,a as d,d as t,b as i,f as w,g as u,j as M,k as y,l as s,m as r,n as p,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as je}from"../chunks/CopyLLMTxtMenu.fb2ec027.js";import{D as R}from"../chunks/Docstring.86a664ae.js";import{C as Se}from"../chunks/CodeBlock.d30a6509.js";import{H as we,E as Ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.09d4dba9.js";function Ve(Me){let _,X,W,B,T,J,L,Q,A,ye='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.',Y,D,Te="The model can be loaded with the following code snippet.",ee,K,te,k,ne,a,C,ue,j,Le=`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>.`,pe,S,Ae=`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).`,fe,U,E,he,b,Z,ge,V,De=`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.`,_e,$,z,ve,q,Ke="Decode a batch of images using a tiled decoder.",be,x,I,$e,H,ke="Encode a batch of images using a tiled encoder.",oe,O,ie,v,N,xe,G,Ce="Output of decoding method.",se,P,ae,F,re;return T=new je({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),L=new we({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),K=new Se({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}}),k=new we({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLMochi",headingTag:"h2"}}),C=new R({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"}}),E=new R({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"}}),Z=new R({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"}}),z=new R({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#L1016",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>
`}}),I=new R({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#L959",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>
`}}),O=new we({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),N=new R({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"}}),P=new Ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_mochi.md"}}),{c(){_=l("meta"),X=o(),W=l("p"),B=o(),m(T.$$.fragment),J=o(),m(L.$$.fragment),Q=o(),A=l("p"),A.innerHTML=ye,Y=o(),D=l("p"),D.textContent=Te,ee=o(),m(K.$$.fragment),te=o(),m(k.$$.fragment),ne=o(),a=l("div"),m(C.$$.fragment),ue=o(),j=l("p"),j.innerHTML=Le,pe=o(),S=l("p"),S.innerHTML=Ae,fe=o(),U=l("div"),m(E.$$.fragment),he=o(),b=l("div"),m(Z.$$.fragment),ge=o(),V=l("p"),V.textContent=De,_e=o(),$=l("div"),m(z.$$.fragment),ve=o(),q=l("p"),q.textContent=Ke,be=o(),x=l("div"),m(I.$$.fragment),$e=o(),H=l("p"),H.textContent=ke,oe=o(),m(O.$$.fragment),ie=o(),v=l("div"),m(N.$$.fragment),xe=o(),G=l("p"),G.textContent=Ce,se=o(),m(P.$$.fragment),ae=o(),F=l("p"),this.h()},l(e){const n=Pe("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(t),X=i(e),W=d(e,"P",{}),w(W).forEach(t),B=i(e),u(T.$$.fragment,e),J=i(e),u(L.$$.fragment,e),Q=i(e),A=d(e,"P",{"data-svelte-h":!0}),M(A)!=="svelte-1jrzq50"&&(A.innerHTML=ye),Y=i(e),D=d(e,"P",{"data-svelte-h":!0}),M(D)!=="svelte-1vuni30"&&(D.textContent=Te),ee=i(e),u(K.$$.fragment,e),te=i(e),u(k.$$.fragment,e),ne=i(e),a=d(e,"DIV",{class:!0});var c=w(a);u(C.$$.fragment,c),ue=i(c),j=d(c,"P",{"data-svelte-h":!0}),M(j)!=="svelte-osx1y"&&(j.innerHTML=Le),pe=i(c),S=d(c,"P",{"data-svelte-h":!0}),M(S)!=="svelte-1hyu2ru"&&(S.innerHTML=Ae),fe=i(c),U=d(c,"DIV",{class:!0});var Ee=w(U);u(E.$$.fragment,Ee),Ee.forEach(t),he=i(c),b=d(c,"DIV",{class:!0});var le=w(b);u(Z.$$.fragment,le),ge=i(le),V=d(le,"P",{"data-svelte-h":!0}),M(V)!=="svelte-1xwrf7t"&&(V.textContent=De),le.forEach(t),_e=i(c),$=d(c,"DIV",{class:!0});var de=w($);u(z.$$.fragment,de),ve=i(de),q=d(de,"P",{"data-svelte-h":!0}),M(q)!=="svelte-1vrxp2b"&&(q.textContent=Ke),de.forEach(t),be=i(c),x=d(c,"DIV",{class:!0});var ce=w(x);u(I.$$.fragment,ce),$e=i(ce),H=d(ce,"P",{"data-svelte-h":!0}),M(H)!=="svelte-1un5fcn"&&(H.textContent=ke),ce.forEach(t),c.forEach(t),oe=i(e),u(O.$$.fragment,e),ie=i(e),v=d(e,"DIV",{class:!0});var me=w(v);u(N.$$.fragment,me),xe=i(me),G=d(me,"P",{"data-svelte-h":!0}),M(G)!=="svelte-18u8upa"&&(G.textContent=Ce),me.forEach(t),se=i(e),u(P.$$.fragment,e),ae=i(e),F=d(e,"P",{}),w(F).forEach(t),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",qe),y(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(v,"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,n){s(document.head,_),r(e,X,n),r(e,W,n),r(e,B,n),p(T,e,n),r(e,J,n),p(L,e,n),r(e,Q,n),r(e,A,n),r(e,Y,n),r(e,D,n),r(e,ee,n),p(K,e,n),r(e,te,n),p(k,e,n),r(e,ne,n),r(e,a,n),p(C,a,null),s(a,ue),s(a,j),s(a,pe),s(a,S),s(a,fe),s(a,U),p(E,U,null),s(a,he),s(a,b),p(Z,b,null),s(b,ge),s(b,V),s(a,_e),s(a,$),p(z,$,null),s($,ve),s($,q),s(a,be),s(a,x),p(I,x,null),s(x,$e),s(x,H),r(e,oe,n),p(O,e,n),r(e,ie,n),r(e,v,n),p(N,v,null),s(v,xe),s(v,G),r(e,se,n),p(P,e,n),r(e,ae,n),r(e,F,n),re=!0},p:ze,i(e){re||(f(T.$$.fragment,e),f(L.$$.fragment,e),f(K.$$.fragment,e),f(k.$$.fragment,e),f(C.$$.fragment,e),f(E.$$.fragment,e),f(Z.$$.fragment,e),f(z.$$.fragment,e),f(I.$$.fragment,e),f(O.$$.fragment,e),f(N.$$.fragment,e),f(P.$$.fragment,e),re=!0)},o(e){h(T.$$.fragment,e),h(L.$$.fragment,e),h(K.$$.fragment,e),h(k.$$.fragment,e),h(C.$$.fragment,e),h(E.$$.fragment,e),h(Z.$$.fragment,e),h(z.$$.fragment,e),h(I.$$.fragment,e),h(O.$$.fragment,e),h(N.$$.fragment,e),h(P.$$.fragment,e),re=!1},d(e){e&&(t(X),t(W),t(B),t(J),t(Q),t(A),t(Y),t(D),t(ee),t(te),t(ne),t(a),t(oe),t(ie),t(v),t(se),t(ae),t(F)),t(_),g(T,e),g(L,e),g(K,e),g(k,e),g(C),g(E),g(Z),g(z),g(I),g(O,e),g(N),g(P,e)}}}const qe='{"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 He(Me){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Je extends Oe{constructor(_){super(),Ne(this,_,He,Ve,Ze,{})}}export{Je as component};
