import{s as se,n as ae,o as ie}from"../chunks/scheduler.53228c21.js";import{S as de,i as me,e as m,s as r,c as f,h as le,a as l,d as o,b as s,f as S,g as c,j as Y,k as W,l as z,m as n,n as u,t as p,o as h,p as _}from"../chunks/index.100fac89.js";import{C as fe}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as re}from"../chunks/Docstring.db856a1e.js";import{C as ce}from"../chunks/CodeBlock.d30a6509.js";import{H as F,E as ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function pe(K){let a,C,Z,J,g,L,M,E,$,ee='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.',H,T,te="The model can be loaded with the following code snippet.",N,b,P,v,X,i,x,A,q,oe='A Transformer model for video-like data introduced in <a href="https://huggingface.co/genmo/mochi-1-preview" rel="nofollow">Mochi</a>.',B,y,I,d,D,Q,k,ne='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',O,w,R,j,V;return g=new fe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),M=new F({props:{title:"MochiTransformer3DModel",local:"mochitransformer3dmodel",headingTag:"h1"}}),b=new ce({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}}),v=new F({props:{title:"MochiTransformer3DModel",local:"diffusers.MochiTransformer3DModel",headingTag:"h2"}}),x=new re({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#L309"}}),y=new F({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),D=new re({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#L21"}}),w=new ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/mochi_transformer3d.md"}}),{c(){a=m("meta"),C=r(),Z=m("p"),J=r(),f(g.$$.fragment),L=r(),f(M.$$.fragment),E=r(),$=m("p"),$.innerHTML=ee,H=r(),T=m("p"),T.textContent=te,N=r(),f(b.$$.fragment),P=r(),f(v.$$.fragment),X=r(),i=m("div"),f(x.$$.fragment),A=r(),q=m("p"),q.innerHTML=oe,B=r(),f(y.$$.fragment),I=r(),d=m("div"),f(D.$$.fragment),Q=r(),k=m("p"),k.innerHTML=ne,O=r(),f(w.$$.fragment),R=r(),j=m("p"),this.h()},l(e){const t=le("svelte-u9bgzb",document.head);a=l(t,"META",{name:!0,content:!0}),t.forEach(o),C=s(e),Z=l(e,"P",{}),S(Z).forEach(o),J=s(e),c(g.$$.fragment,e),L=s(e),c(M.$$.fragment,e),E=s(e),$=l(e,"P",{"data-svelte-h":!0}),Y($)!=="svelte-1up2xls"&&($.innerHTML=ee),H=s(e),T=l(e,"P",{"data-svelte-h":!0}),Y(T)!=="svelte-1vuni30"&&(T.textContent=te),N=s(e),c(b.$$.fragment,e),P=s(e),c(v.$$.fragment,e),X=s(e),i=l(e,"DIV",{class:!0});var G=S(i);c(x.$$.fragment,G),A=s(G),q=l(G,"P",{"data-svelte-h":!0}),Y(q)!=="svelte-133wd4y"&&(q.innerHTML=oe),G.forEach(o),B=s(e),c(y.$$.fragment,e),I=s(e),d=l(e,"DIV",{class:!0});var U=S(d);c(D.$$.fragment,U),Q=s(U),k=l(U,"P",{"data-svelte-h":!0}),Y(k)!=="svelte-1x8c0js"&&(k.innerHTML=ne),U.forEach(o),O=s(e),c(w.$$.fragment,e),R=s(e),j=l(e,"P",{}),S(j).forEach(o),this.h()},h(){W(a,"name","hf:doc:metadata"),W(a,"content",he),W(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(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){z(document.head,a),n(e,C,t),n(e,Z,t),n(e,J,t),u(g,e,t),n(e,L,t),u(M,e,t),n(e,E,t),n(e,$,t),n(e,H,t),n(e,T,t),n(e,N,t),u(b,e,t),n(e,P,t),u(v,e,t),n(e,X,t),n(e,i,t),u(x,i,null),z(i,A),z(i,q),n(e,B,t),u(y,e,t),n(e,I,t),n(e,d,t),u(D,d,null),z(d,Q),z(d,k),n(e,O,t),u(w,e,t),n(e,R,t),n(e,j,t),V=!0},p:ae,i(e){V||(p(g.$$.fragment,e),p(M.$$.fragment,e),p(b.$$.fragment,e),p(v.$$.fragment,e),p(x.$$.fragment,e),p(y.$$.fragment,e),p(D.$$.fragment,e),p(w.$$.fragment,e),V=!0)},o(e){h(g.$$.fragment,e),h(M.$$.fragment,e),h(b.$$.fragment,e),h(v.$$.fragment,e),h(x.$$.fragment,e),h(y.$$.fragment,e),h(D.$$.fragment,e),h(w.$$.fragment,e),V=!1},d(e){e&&(o(C),o(Z),o(J),o(L),o(E),o($),o(H),o(T),o(N),o(P),o(X),o(i),o(B),o(I),o(d),o(O),o(R),o(j)),o(a),_(g,e),_(M,e),_(b,e),_(v,e),_(x),_(y,e),_(D),_(w,e)}}}const he='{"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 _e(K){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends de{constructor(a){super(),me(this,a,_e,pe,se,{})}}export{xe as component};
