Buckets:

rtrm's picture
download
raw
15.3 kB
import{s as Ne,n as Ze,o as ze}from"../chunks/scheduler.53228c21.js";import{S as Ie,i as Pe,e as l,s as n,c as m,h as je,a as d,d as t,b as s,f as w,g as u,j as M,k as y,l as r,m as a,n as p,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as Se}from"../chunks/CopyLLMTxtMenu.67e413d2.js";import{D as R}from"../chunks/Docstring.60584164.js";import{C as Ue}from"../chunks/CodeBlock.d30a6509.js";import{H as we,E as Ve}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.debde53c.js";function qe(Me){let _,X,W,B,L,J,T,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,Le="The model can be loaded with the following code snippet.",ee,K,te,k,oe,i,C,ue,S,Te=`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,U,Ae=`This model inherits from <a href="/docs/diffusers/pr_13331/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,V,E,he,b,N,ge,q,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,O,Ke="Decode a batch of images using a tiled decoder.",be,x,z,$e,H,ke="Encode a batch of images using a tiled encoder.",ne,I,se,v,P,xe,G,Ce="Output of decoding method.",re,j,ie,F,ae;return L=new Se({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new we({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),K=new Ue({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:": 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) &#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/vr_13331/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L655"}}),E=new R({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMochi.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/utils/accelerate_utils.py#L43"}}),N=new R({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>) &#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_13331/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L786"}}),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/vr_13331/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 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/vr_13331/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>
`}}),I=new we({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),P=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:": 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>) &#x2014;
The decoded output sample from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/models/autoencoders/vae.py#L46"}}),j=new Ve({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_mochi.md"}}),{c(){_=l("meta"),X=n(),W=l("p"),B=n(),m(L.$$.fragment),J=n(),m(T.$$.fragment),Q=n(),A=l("p"),A.innerHTML=ye,Y=n(),D=l("p"),D.textContent=Le,ee=n(),m(K.$$.fragment),te=n(),m(k.$$.fragment),oe=n(),i=l("div"),m(C.$$.fragment),ue=n(),S=l("p"),S.innerHTML=Te,pe=n(),U=l("p"),U.innerHTML=Ae,fe=n(),V=l("div"),m(E.$$.fragment),he=n(),b=l("div"),m(N.$$.fragment),ge=n(),q=l("p"),q.textContent=De,_e=n(),$=l("div"),m(Z.$$.fragment),ve=n(),O=l("p"),O.textContent=Ke,be=n(),x=l("div"),m(z.$$.fragment),$e=n(),H=l("p"),H.textContent=ke,ne=n(),m(I.$$.fragment),se=n(),v=l("div"),m(P.$$.fragment),xe=n(),G=l("p"),G.textContent=Ce,re=n(),m(j.$$.fragment),ie=n(),F=l("p"),this.h()},l(e){const o=je("svelte-u9bgzb",document.head);_=d(o,"META",{name:!0,content:!0}),o.forEach(t),X=s(e),W=d(e,"P",{}),w(W).forEach(t),B=s(e),u(L.$$.fragment,e),J=s(e),u(T.$$.fragment,e),Q=s(e),A=d(e,"P",{"data-svelte-h":!0}),M(A)!=="svelte-1jrzq50"&&(A.innerHTML=ye),Y=s(e),D=d(e,"P",{"data-svelte-h":!0}),M(D)!=="svelte-1vuni30"&&(D.textContent=Le),ee=s(e),u(K.$$.fragment,e),te=s(e),u(k.$$.fragment,e),oe=s(e),i=d(e,"DIV",{class:!0});var c=w(i);u(C.$$.fragment,c),ue=s(c),S=d(c,"P",{"data-svelte-h":!0}),M(S)!=="svelte-osx1y"&&(S.innerHTML=Te),pe=s(c),U=d(c,"P",{"data-svelte-h":!0}),M(U)!=="svelte-szgy71"&&(U.innerHTML=Ae),fe=s(c),V=d(c,"DIV",{class:!0});var Ee=w(V);u(E.$$.fragment,Ee),Ee.forEach(t),he=s(c),b=d(c,"DIV",{class:!0});var le=w(b);u(N.$$.fragment,le),ge=s(le),q=d(le,"P",{"data-svelte-h":!0}),M(q)!=="svelte-1xwrf7t"&&(q.textContent=De),le.forEach(t),_e=s(c),$=d(c,"DIV",{class:!0});var de=w($);u(Z.$$.fragment,de),ve=s(de),O=d(de,"P",{"data-svelte-h":!0}),M(O)!=="svelte-1vrxp2b"&&(O.textContent=Ke),de.forEach(t),be=s(c),x=d(c,"DIV",{class:!0});var ce=w(x);u(z.$$.fragment,ce),$e=s(ce),H=d(ce,"P",{"data-svelte-h":!0}),M(H)!=="svelte-1un5fcn"&&(H.textContent=ke),ce.forEach(t),c.forEach(t),ne=s(e),u(I.$$.fragment,e),se=s(e),v=d(e,"DIV",{class:!0});var me=w(v);u(P.$$.fragment,me),xe=s(me),G=d(me,"P",{"data-svelte-h":!0}),M(G)!=="svelte-18u8upa"&&(G.textContent=Ce),me.forEach(t),re=s(e),u(j.$$.fragment,e),ie=s(e),F=d(e,"P",{}),w(F).forEach(t),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",Oe),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"),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(i,"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,o){r(document.head,_),a(e,X,o),a(e,W,o),a(e,B,o),p(L,e,o),a(e,J,o),p(T,e,o),a(e,Q,o),a(e,A,o),a(e,Y,o),a(e,D,o),a(e,ee,o),p(K,e,o),a(e,te,o),p(k,e,o),a(e,oe,o),a(e,i,o),p(C,i,null),r(i,ue),r(i,S),r(i,pe),r(i,U),r(i,fe),r(i,V),p(E,V,null),r(i,he),r(i,b),p(N,b,null),r(b,ge),r(b,q),r(i,_e),r(i,$),p(Z,$,null),r($,ve),r($,O),r(i,be),r(i,x),p(z,x,null),r(x,$e),r(x,H),a(e,ne,o),p(I,e,o),a(e,se,o),a(e,v,o),p(P,v,null),r(v,xe),r(v,G),a(e,re,o),p(j,e,o),a(e,ie,o),a(e,F,o),ae=!0},p:Ze,i(e){ae||(f(L.$$.fragment,e),f(T.$$.fragment,e),f(K.$$.fragment,e),f(k.$$.fragment,e),f(C.$$.fragment,e),f(E.$$.fragment,e),f(N.$$.fragment,e),f(Z.$$.fragment,e),f(z.$$.fragment,e),f(I.$$.fragment,e),f(P.$$.fragment,e),f(j.$$.fragment,e),ae=!0)},o(e){h(L.$$.fragment,e),h(T.$$.fragment,e),h(K.$$.fragment,e),h(k.$$.fragment,e),h(C.$$.fragment,e),h(E.$$.fragment,e),h(N.$$.fragment,e),h(Z.$$.fragment,e),h(z.$$.fragment,e),h(I.$$.fragment,e),h(P.$$.fragment,e),h(j.$$.fragment,e),ae=!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(oe),t(i),t(ne),t(se),t(v),t(re),t(ie),t(F)),t(_),g(L,e),g(T,e),g(K,e),g(k,e),g(C),g(E),g(N),g(Z),g(z),g(I,e),g(P),g(j,e)}}}const Oe='{"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 ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Je extends Ie{constructor(_){super(),Pe(this,_,He,qe,Ne,{})}}export{Je as component};

Xet Storage Details

Size:
15.3 kB
·
Xet hash:
1d8c3576dd46c72b5a3224178f5cc1d9ff10d14907bc9a1965c9082f8e3cc057

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.