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 G,u as $,x as U,k as Y,y as j,a as n,v,d as x,t as y,w as D}from"../chunks/index.da70eac4.js";import{D as oe}from"../chunks/Docstring.a42c214b.js";import{C as me}from"../chunks/CodeBlock.a9c4becf.js";import{H as W,E as le}from"../chunks/getInferenceSnippets.a8672208.js";function ce(Q){let a,z,k,J,c,C,f,F='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.',E,u,K="The model can be loaded with the following code snippet.",H,h,N,p,P,i,_,A,w,ee='A Transformer model for video-like data introduced in <a href="https://huggingface.co/genmo/mochi-1-preview" rel="nofollow">Mochi</a>.',X,g,B,d,M,S,q,te='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',I,T,L,Z,O;return c=new W({props:{title:"MochiTransformer3DModel",local:"mochitransformer3dmodel",headingTag:"h1"}}),h=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyME1vY2hpVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBNb2NoaVRyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ2VubW8lMkZtb2NoaS0xLXByZXZpZXclMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0cmFuc2Zvcm1lciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> MochiTransformer3DModel

transformer = 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 W({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/main/src/diffusers/models/transformers/transformer_mochi.py#L308"}}),g=new W({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/main/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/main/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"),z=r(),k=m("p"),J=r(),b(c.$$.fragment),C=r(),f=m("p"),f.innerHTML=F,E=r(),u=m("p"),u.textContent=K,H=r(),b(h.$$.fragment),N=r(),b(p.$$.fragment),P=r(),i=m("div"),b(_.$$.fragment),A=r(),w=m("p"),w.innerHTML=ee,X=r(),b(g.$$.fragment),B=r(),d=m("div"),b(M.$$.fragment),S=r(),q=m("p"),q.innerHTML=te,I=r(),b(T.$$.fragment),L=r(),Z=m("p"),this.h()},l(e){const t=de("svelte-u9bgzb",document.head);a=l(t,"META",{name:!0,content:!0}),t.forEach(o),z=s(e),k=l(e,"P",{}),G(k).forEach(o),J=s(e),$(c.$$.fragment,e),C=s(e),f=l(e,"P",{"data-svelte-h":!0}),U(f)!=="svelte-1up2xls"&&(f.innerHTML=F),E=s(e),u=l(e,"P",{"data-svelte-h":!0}),U(u)!=="svelte-1vuni30"&&(u.textContent=K),H=s(e),$(h.$$.fragment,e),N=s(e),$(p.$$.fragment,e),P=s(e),i=l(e,"DIV",{class:!0});var R=G(i);$(_.$$.fragment,R),A=s(R),w=l(R,"P",{"data-svelte-h":!0}),U(w)!=="svelte-133wd4y"&&(w.innerHTML=ee),R.forEach(o),X=s(e),$(g.$$.fragment,e),B=s(e),d=l(e,"DIV",{class:!0});var V=G(d);$(M.$$.fragment,V),S=s(V),q=l(V,"P",{"data-svelte-h":!0}),U(q)!=="svelte-1x8c0js"&&(q.innerHTML=te),V.forEach(o),I=s(e),$(T.$$.fragment,e),L=s(e),Z=l(e,"P",{}),G(Z).forEach(o),this.h()},h(){Y(a,"name","hf:doc:metadata"),Y(a,"content",fe),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(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,z,t),n(e,k,t),n(e,J,t),v(c,e,t),n(e,C,t),n(e,f,t),n(e,E,t),n(e,u,t),n(e,H,t),v(h,e,t),n(e,N,t),v(p,e,t),n(e,P,t),n(e,i,t),v(_,i,null),j(i,A),j(i,w),n(e,X,t),v(g,e,t),n(e,B,t),n(e,d,t),v(M,d,null),j(d,S),j(d,q),n(e,I,t),v(T,e,t),n(e,L,t),n(e,Z,t),O=!0},p:re,i(e){O||(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),O=!0)},o(e){y(c.$$.fragment,e),y(h.$$.fragment,e),y(p.$$.fragment,e),y(_.$$.fragment,e),y(g.$$.fragment,e),y(M.$$.fragment,e),y(T.$$.fragment,e),O=!1},d(e){e&&(o(z),o(k),o(J),o(C),o(f),o(E),o(u),o(H),o(N),o(P),o(i),o(X),o(B),o(d),o(I),o(L),o(Z)),o(a),D(c,e),D(h,e),D(p,e),D(_),D(g,e),D(M),D(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(Q){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};
