Buckets:

download
raw
17.4 kB
import{s as je,n as Oe,o as Pe}from"../chunks/scheduler.53228c21.js";import{S as Ve,i as Se,e as i,s as n,c as m,h as Ue,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 Ge}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as V}from"../chunks/Docstring.9de32ff4.js";import{C as qe}from"../chunks/CodeBlock.606cbaf4.js";import{H as Te,E as He}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function We(ye){let _,J,X,Q,T,Y,y,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 &amp; ZhipuAI.',te,D,De="The model can be loaded with the following code snippet.",oe,K,ne,k,re,a,C,fe,S,Ke=`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,U,ke=`This model inherits from <a href="/docs/diffusers/pr_13921/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,G,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,j,ae,v,O,Le,R,Ie="Output of decoding method.",ie,P,de,B,le;return T=new Ge({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new Te({props:{title:"AutoencoderKLMochi",local:"autoencoderklmochi",headingTag:"h1"}}),K=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">&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>)`,lang:"python",wrap:!1}}),k=new Te({props:{title:"AutoencoderKLMochi",local:"diffusers.AutoencoderKLMochi",headingTag:"h2"}}),C=new V({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_13921/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L655"}}),N=new V({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLMochi.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/utils/accelerate_utils.py#L43"}}),E=new V({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_13921/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L786"}}),I=new V({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>) &#x2014; 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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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_13921/src/diffusers/models/autoencoders/autoencoder_kl_mochi.py#L1089",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> 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 V({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_13921/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 V({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_13921/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>
`}}),j=new Te({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),O=new V({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_13921/src/diffusers/models/autoencoders/vae.py#L46"}}),P=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(T.$$.fragment),Y=n(),m(y.$$.fragment),ee=n(),A=i("p"),A.innerHTML=Ae,te=n(),D=i("p"),D.textContent=De,oe=n(),m(K.$$.fragment),ne=n(),m(k.$$.fragment),re=n(),a=i("div"),m(C.$$.fragment),fe=n(),S=i("p"),S.innerHTML=Ke,he=n(),U=i("p"),U.innerHTML=ke,ge=n(),G=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(j.$$.fragment),ae=n(),v=i("div"),m(O.$$.fragment),Le=n(),R=i("p"),R.textContent=Ie,ie=n(),m(P.$$.fragment),de=n(),B=i("p"),this.h()},l(e){const o=Ue("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(T.$$.fragment,e),Y=r(e),u(y.$$.fragment,e),ee=r(e),A=d(e,"P",{"data-svelte-h":!0}),L(A)!=="svelte-1jrzq50"&&(A.innerHTML=Ae),te=r(e),D=d(e,"P",{"data-svelte-h":!0}),L(D)!=="svelte-1vuni30"&&(D.textContent=De),oe=r(e),u(K.$$.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),S=d(c,"P",{"data-svelte-h":!0}),L(S)!=="svelte-osx1y"&&(S.innerHTML=Ke),he=r(c),U=d(c,"P",{"data-svelte-h":!0}),L(U)!=="svelte-j24tt4"&&(U.innerHTML=ke),ge=r(c),G=d(c,"DIV",{class:!0});var Ze=b(G);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(j.$$.fragment,e),ae=r(e),v=d(e,"DIV",{class:!0});var pe=b(v);u(O.$$.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(P.$$.fragment,e),de=r(e),B=d(e,"P",{}),b(B).forEach(t),this.h()},h(){$(_,"name","hf:doc:metadata"),$(_,"content",Fe),$(G,"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(T,e,o),l(e,Y,o),p(y,e,o),l(e,ee,o),l(e,A,o),l(e,te,o),l(e,D,o),l(e,oe,o),p(K,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,S),s(a,he),s(a,U),s(a,ge),s(a,G),p(N,G,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(j,e,o),l(e,ae,o),l(e,v,o),p(O,v,null),s(v,Le),s(v,R),l(e,ie,o),p(P,e,o),l(e,de,o),l(e,B,o),le=!0},p:Oe,i(e){le||(f(T.$$.fragment,e),f(y.$$.fragment,e),f(K.$$.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(j.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),le=!0)},o(e){h(T.$$.fragment,e),h(y.$$.fragment,e),h(K.$$.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(j.$$.fragment,e),h(O.$$.fragment,e),h(P.$$.fragment,e),le=!1},d(e){e&&(t(J),t(X),t(Q),t(Y),t(ee),t(A),t(te),t(D),t(oe),t(ne),t(re),t(a),t(se),t(ae),t(v),t(ie),t(de),t(B)),t(_),g(T,e),g(y,e),g(K,e),g(k,e),g(C),g(N),g(E),g(I),g(Z),g(z),g(j,e),g(O),g(P,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(ye){return Pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends Ve{constructor(_){super(),Se(this,_,Re,We,je,{})}}export{tt as component};

Xet Storage Details

Size:
17.4 kB
·
Xet hash:
c9851759fe929b2378d4e62a30de0ce8e2fc1e8e3dca31e5701172e59a1a223c

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