import{s as ne,n as re,o as se}from"../chunks/scheduler.8c3d61f6.js";import{S as ae,i as ie,g as m,s as r,r as b,A as de,h as l,f as o,c as s,j as R,u as $,x as S,k as A,y as j,a as n,v,d as D,t as x,w}from"../chunks/index.da70eac4.js";import{D as oe}from"../chunks/Docstring.6b390b9a.js";import{C as me}from"../chunks/CodeBlock.00a903b3.js";import{H as K,E as le}from"../chunks/EditOnGithub.1e64e623.js";function ce(X){let a,E,J,Z,c,I,f,Y='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://huggingface.co/genmo/mochi-1-preview" rel="nofollow">Mochi-1 Preview</a> by Genmo.',C,u,Q="The model can be loaded with the following code snippet.",H,h,V,p,z,i,_,F,y,ee='A Transformer model for video-like data introduced in <a href="https://huggingface.co/genmo/mochi-1-preview" rel="nofollow">Mochi</a>.',G,g,L,d,M,W,q,te='The output of <a href="/docs/diffusers/pr_10135/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',P,T,O,k,N;return c=new K({props:{title:"MochiTransformer3DModel",local:"mochitransformer3dmodel",headingTag:"h1"}}),h=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyME1vY2hpVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdmFlJTIwJTNEJTIwTW9jaGlUcmFuc2Zvcm1lcjNETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdlbm1vJTJGbW9jaGktMS1wcmV2aWV3JTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> MochiTransformer3DModel

vae = MochiTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;genmo/mochi-1-preview&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),p=new K({props:{title:"MochiTransformer3DModel",local:"diffusers.MochiTransformer3DModel",headingTag:"h2"}}),_=new oe({props:{name:"class diffusers.MochiTransformer3DModel",anchor:"diffusers.MochiTransformer3DModel",parameters:[{name:"patch_size",val:": int = 2"},{name:"num_attention_heads",val:": int = 24"},{name:"attention_head_dim",val:": int = 128"},{name:"num_layers",val:": int = 48"},{name:"pooled_projection_dim",val:": int = 1536"},{name:"in_channels",val:": int = 12"},{name:"out_channels",val:": typing.Optional[int] = None"},{name:"qk_norm",val:": str = 'rms_norm'"},{name:"text_embed_dim",val:": int = 4096"},{name:"time_embed_dim",val:": int = 256"},{name:"activation_fn",val:": str = 'swiglu'"},{name:"max_sequence_length",val:": int = 256"}],parametersDescription:[{anchor:"diffusers.MochiTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
The size of the patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.MochiTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.MochiTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.MochiTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.MochiTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>12</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.MochiTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.MochiTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>&quot;rms_norm&quot;</code>) &#x2014;
The normalization layer to use.`,name:"qk_norm"},{anchor:"diffusers.MochiTransformer3DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.MochiTransformer3DModel.time_embed_dim",description:`<strong>time_embed_dim</strong> (<code>int</code>, defaults to <code>256</code>) &#x2014;
Output dimension of timestep embeddings.`,name:"time_embed_dim"},{anchor:"diffusers.MochiTransformer3DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, defaults to <code>&quot;swiglu&quot;</code>) &#x2014;
Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.MochiTransformer3DModel.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>256</code>) &#x2014;
The maximum sequence length of text embeddings supported.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/vr_10135/src/diffusers/models/transformers/transformer_mochi.py#L225"}}),g=new K({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),M=new oe({props:{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",parameters:[{name:"sample",val:": torch.Tensor"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>(batch size, num_vector_embeds - 1, num_latent_pixels)</code> if <a href="/docs/diffusers/pr_10135/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) &#x2014;
The hidden states output conditioned on the <code>encoder_hidden_states</code> input. If discrete, returns probability
distributions for the unnoised latent pixels.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_10135/src/diffusers/models/modeling_outputs.py#L20"}}),T=new le({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/mochi_transformer3d.md"}}),{c(){a=m("meta"),E=r(),J=m("p"),Z=r(),b(c.$$.fragment),I=r(),f=m("p"),f.innerHTML=Y,C=r(),u=m("p"),u.textContent=Q,H=r(),b(h.$$.fragment),V=r(),b(p.$$.fragment),z=r(),i=m("div"),b(_.$$.fragment),F=r(),y=m("p"),y.innerHTML=ee,G=r(),b(g.$$.fragment),L=r(),d=m("div"),b(M.$$.fragment),W=r(),q=m("p"),q.innerHTML=te,P=r(),b(T.$$.fragment),O=r(),k=m("p"),this.h()},l(e){const t=de("svelte-u9bgzb",document.head);a=l(t,"META",{name:!0,content:!0}),t.forEach(o),E=s(e),J=l(e,"P",{}),R(J).forEach(o),Z=s(e),$(c.$$.fragment,e),I=s(e),f=l(e,"P",{"data-svelte-h":!0}),S(f)!=="svelte-1up2xls"&&(f.innerHTML=Y),C=s(e),u=l(e,"P",{"data-svelte-h":!0}),S(u)!=="svelte-1vuni30"&&(u.textContent=Q),H=s(e),$(h.$$.fragment,e),V=s(e),$(p.$$.fragment,e),z=s(e),i=l(e,"DIV",{class:!0});var U=R(i);$(_.$$.fragment,U),F=s(U),y=l(U,"P",{"data-svelte-h":!0}),S(y)!=="svelte-133wd4y"&&(y.innerHTML=ee),U.forEach(o),G=s(e),$(g.$$.fragment,e),L=s(e),d=l(e,"DIV",{class:!0});var B=R(d);$(M.$$.fragment,B),W=s(B),q=l(B,"P",{"data-svelte-h":!0}),S(q)!=="svelte-1472784"&&(q.innerHTML=te),B.forEach(o),P=s(e),$(T.$$.fragment,e),O=s(e),k=l(e,"P",{}),R(k).forEach(o),this.h()},h(){A(a,"name","hf:doc:metadata"),A(a,"content",fe),A(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(d,"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,t){j(document.head,a),n(e,E,t),n(e,J,t),n(e,Z,t),v(c,e,t),n(e,I,t),n(e,f,t),n(e,C,t),n(e,u,t),n(e,H,t),v(h,e,t),n(e,V,t),v(p,e,t),n(e,z,t),n(e,i,t),v(_,i,null),j(i,F),j(i,y),n(e,G,t),v(g,e,t),n(e,L,t),n(e,d,t),v(M,d,null),j(d,W),j(d,q),n(e,P,t),v(T,e,t),n(e,O,t),n(e,k,t),N=!0},p:re,i(e){N||(D(c.$$.fragment,e),D(h.$$.fragment,e),D(p.$$.fragment,e),D(_.$$.fragment,e),D(g.$$.fragment,e),D(M.$$.fragment,e),D(T.$$.fragment,e),N=!0)},o(e){x(c.$$.fragment,e),x(h.$$.fragment,e),x(p.$$.fragment,e),x(_.$$.fragment,e),x(g.$$.fragment,e),x(M.$$.fragment,e),x(T.$$.fragment,e),N=!1},d(e){e&&(o(E),o(J),o(Z),o(I),o(f),o(C),o(u),o(H),o(V),o(z),o(i),o(G),o(L),o(d),o(P),o(O),o(k)),o(a),w(c,e),w(h,e),w(p,e),w(_),w(g,e),w(M),w(T,e)}}}const fe='{"title":"MochiTransformer3DModel","local":"mochitransformer3dmodel","sections":[{"title":"MochiTransformer3DModel","local":"diffusers.MochiTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function ue(X){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends ae{constructor(a){super(),ie(this,a,ue,ce,ne,{})}}export{Te as component};
