Buckets:
| import{s as Pe,n as Ve,o as je}from"../chunks/scheduler.53228c21.js";import{S as Se,i as Ue,e as i,s as n,c as m,h as Ge,a as d,d as t,b as r,f as b,g as u,j as L,k as $,l as s,m as l,n as p,t as f,o as h,p as g}from"../chunks/index.cac5d66a.js";import{C as Oe}from"../chunks/CopyLLMTxtMenu.4912207d.js";import{D as S}from"../chunks/Docstring.1e7ac4f3.js";import{C as qe}from"../chunks/CodeBlock.606cbaf4.js";import{H as ye,E as He}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.323ee77a.js";function We(Te){let _,J,X,Q,y,Y,T,ee,A,Ae='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 & ZhipuAI.',te,K,Ke="The model can be loaded with the following code snippet.",oe,D,ne,k,re,a,C,fe,U,De=`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>.`,he,G,ke=`This model inherits from <a href="/docs/diffusers/pr_13745/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).`,ge,O,N,_e,x,E,ve,q,Ce=`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.`,be,H,I,$e,w,Z,xe,W,Ne="Decode a batch of images using a tiled decoder.",we,M,z,Me,F,Ee="Encode a batch of images using a tiled encoder.",se,P,ae,v,V,Le,R,Ie="Output of decoding method.",ie,j,de,B,le;return y=new Oe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new ye({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),D=new qe({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">"genmo/mochi-1-preview"</span>, subfolder=<span class="hljs-string">"vae"</span>, torch_dtype=torch.float32).to(<span class="hljs-string">"cuda"</span>)`,lang:"python",wrap:!1}}),k=new ye({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLMochi",headingTag:"h2"}}),C=new S({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:": tuple = (64, 128, 256, 384)"},{name:"decoder_block_out_channels",val:": tuple = (128, 256, 512, 768)"},{name:"latent_channels",val:": int = 12"},{name:"layers_per_block",val:": tuple = (3, 3, 4, 6, 3)"},{name:"act_fn",val:": str = 'silu'"},{name:"temporal_expansions",val:": tuple = (1, 2, 3)"},{name:"spatial_expansions",val:": tuple = (2, 2, 2)"},{name:"add_attention_block",val:": tuple = (False, True, True, True, True)"},{name:"latents_mean",val:": tuple = (-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:": tuple = (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) — 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) — 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>) — | |
| 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>"silu"</code>) — 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>) — | |
| 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/vr_13745/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L655"}}),N=new S({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMochi.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13745/src/diffusers/utils/accelerate_utils.py#L43"}}),E=new S({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLMochi.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": int | None = None"},{name:"tile_sample_min_width",val:": int | None = None"},{name:"tile_sample_stride_height",val:": float | None = None"},{name:"tile_sample_stride_width",val:": float | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMochi.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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_13745/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L786"}}),I=new S({props:{name:"forward",anchor:"diffusers.AutoencoderKLMochi.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": torch._C.Generator | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLMochi.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLMochi.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLMochi.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AutoencoderKLMochi.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make sampling | |
| deterministic.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/vr_13745/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1089"}}),Z=new S({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>) — 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>) — | |
| 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_13745/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1011",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> | |
| `}}),z=new S({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>) — Input batch of videos.",name:"x"}],source:"https://github.com/huggingface/diffusers/blob/vr_13745/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L954",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> | |
| `}}),P=new ye({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),V=new S({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": torch.FloatTensor | None = 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>) — | |
| The decoded output sample from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_13745/src/diffusers/models/autoencoders/vae.py#L46"}}),j=new He({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_mochi.md"}}),{c(){_=i("meta"),J=n(),X=i("p"),Q=n(),m(y.$$.fragment),Y=n(),m(T.$$.fragment),ee=n(),A=i("p"),A.innerHTML=Ae,te=n(),K=i("p"),K.textContent=Ke,oe=n(),m(D.$$.fragment),ne=n(),m(k.$$.fragment),re=n(),a=i("div"),m(C.$$.fragment),fe=n(),U=i("p"),U.innerHTML=De,he=n(),G=i("p"),G.innerHTML=ke,ge=n(),O=i("div"),m(N.$$.fragment),_e=n(),x=i("div"),m(E.$$.fragment),ve=n(),q=i("p"),q.textContent=Ce,be=n(),H=i("div"),m(I.$$.fragment),$e=n(),w=i("div"),m(Z.$$.fragment),xe=n(),W=i("p"),W.textContent=Ne,we=n(),M=i("div"),m(z.$$.fragment),Me=n(),F=i("p"),F.textContent=Ee,se=n(),m(P.$$.fragment),ae=n(),v=i("div"),m(V.$$.fragment),Le=n(),R=i("p"),R.textContent=Ie,ie=n(),m(j.$$.fragment),de=n(),B=i("p"),this.h()},l(e){const o=Ge("svelte-u9bgzb",document.head);_=d(o,"META",{name:!0,content:!0}),o.forEach(t),J=r(e),X=d(e,"P",{}),b(X).forEach(t),Q=r(e),u(y.$$.fragment,e),Y=r(e),u(T.$$.fragment,e),ee=r(e),A=d(e,"P",{"data-svelte-h":!0}),L(A)!=="svelte-1jrzq50"&&(A.innerHTML=Ae),te=r(e),K=d(e,"P",{"data-svelte-h":!0}),L(K)!=="svelte-1vuni30"&&(K.textContent=Ke),oe=r(e),u(D.$$.fragment,e),ne=r(e),u(k.$$.fragment,e),re=r(e),a=d(e,"DIV",{class:!0});var c=b(a);u(C.$$.fragment,c),fe=r(c),U=d(c,"P",{"data-svelte-h":!0}),L(U)!=="svelte-osx1y"&&(U.innerHTML=De),he=r(c),G=d(c,"P",{"data-svelte-h":!0}),L(G)!=="svelte-1x1lm5o"&&(G.innerHTML=ke),ge=r(c),O=d(c,"DIV",{class:!0});var Ze=b(O);u(N.$$.fragment,Ze),Ze.forEach(t),_e=r(c),x=d(c,"DIV",{class:!0});var ce=b(x);u(E.$$.fragment,ce),ve=r(ce),q=d(ce,"P",{"data-svelte-h":!0}),L(q)!=="svelte-1xwrf7t"&&(q.textContent=Ce),ce.forEach(t),be=r(c),H=d(c,"DIV",{class:!0});var ze=b(H);u(I.$$.fragment,ze),ze.forEach(t),$e=r(c),w=d(c,"DIV",{class:!0});var me=b(w);u(Z.$$.fragment,me),xe=r(me),W=d(me,"P",{"data-svelte-h":!0}),L(W)!=="svelte-1vrxp2b"&&(W.textContent=Ne),me.forEach(t),we=r(c),M=d(c,"DIV",{class:!0});var ue=b(M);u(z.$$.fragment,ue),Me=r(ue),F=d(ue,"P",{"data-svelte-h":!0}),L(F)!=="svelte-1un5fcn"&&(F.textContent=Ee),ue.forEach(t),c.forEach(t),se=r(e),u(P.$$.fragment,e),ae=r(e),v=d(e,"DIV",{class:!0});var pe=b(v);u(V.$$.fragment,pe),Le=r(pe),R=d(pe,"P",{"data-svelte-h":!0}),L(R)!=="svelte-18u8upa"&&(R.textContent=Ie),pe.forEach(t),ie=r(e),u(j.$$.fragment,e),de=r(e),B=d(e,"P",{}),b(B).forEach(t),this.h()},h(){$(_,"name","hf:doc:metadata"),$(_,"content",Fe),$(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"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){s(document.head,_),l(e,J,o),l(e,X,o),l(e,Q,o),p(y,e,o),l(e,Y,o),p(T,e,o),l(e,ee,o),l(e,A,o),l(e,te,o),l(e,K,o),l(e,oe,o),p(D,e,o),l(e,ne,o),p(k,e,o),l(e,re,o),l(e,a,o),p(C,a,null),s(a,fe),s(a,U),s(a,he),s(a,G),s(a,ge),s(a,O),p(N,O,null),s(a,_e),s(a,x),p(E,x,null),s(x,ve),s(x,q),s(a,be),s(a,H),p(I,H,null),s(a,$e),s(a,w),p(Z,w,null),s(w,xe),s(w,W),s(a,we),s(a,M),p(z,M,null),s(M,Me),s(M,F),l(e,se,o),p(P,e,o),l(e,ae,o),l(e,v,o),p(V,v,null),s(v,Le),s(v,R),l(e,ie,o),p(j,e,o),l(e,de,o),l(e,B,o),le=!0},p:Ve,i(e){le||(f(y.$$.fragment,e),f(T.$$.fragment,e),f(D.$$.fragment,e),f(k.$$.fragment,e),f(C.$$.fragment,e),f(N.$$.fragment,e),f(E.$$.fragment,e),f(I.$$.fragment,e),f(Z.$$.fragment,e),f(z.$$.fragment,e),f(P.$$.fragment,e),f(V.$$.fragment,e),f(j.$$.fragment,e),le=!0)},o(e){h(y.$$.fragment,e),h(T.$$.fragment,e),h(D.$$.fragment,e),h(k.$$.fragment,e),h(C.$$.fragment,e),h(N.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(Z.$$.fragment,e),h(z.$$.fragment,e),h(P.$$.fragment,e),h(V.$$.fragment,e),h(j.$$.fragment,e),le=!1},d(e){e&&(t(J),t(X),t(Q),t(Y),t(ee),t(A),t(te),t(K),t(oe),t(ne),t(re),t(a),t(se),t(ae),t(v),t(ie),t(de),t(B)),t(_),g(y,e),g(T,e),g(D,e),g(k,e),g(C),g(N),g(E),g(I),g(Z),g(z),g(P,e),g(V),g(j,e)}}}const Fe='{"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 Re(Te){return je(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends Se{constructor(_){super(),Ue(this,_,Re,We,Pe,{})}}export{tt as component}; | |
Xet Storage Details
- Size:
- 17 kB
- Xet hash:
- 845d73f941c81e0e82a1334d3d4b2e315d86c885655f42b1db6a8ef10758c3f2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.