import{s as Se,o as Oe,n as Ve}from"../chunks/scheduler.8c3d61f6.js";import{S as Ue,i as Be,g as l,s,r as f,A as Fe,h as m,f as o,c as a,j as T,u as p,x as $,k as x,y as t,a as u,v as h,d as _,t as g,w as b}from"../chunks/index.589a98e8.js";import{T as Ae}from"../chunks/Tip.42aa8582.js";import{D as F}from"../chunks/Docstring.27406313.js";import{H as Ne,E as Ke}from"../chunks/EditOnGithub.e5a8d9cb.js";function Qe(K){let n,y="This API is 🧪 experimental.";return{c(){n=l("p"),n.textContent=y},l(c){n=m(c,"P",{"data-svelte-h":!0}),$(n)!=="svelte-89q1io"&&(n.textContent=y)},m(c,M){u(c,n,M)},p:Ve,d(c){c&&o(n)}}}function We(K){let n,y="This API is 🧪 experimental.";return{c(){n=l("p"),n.textContent=y},l(c){n=m(c,"P",{"data-svelte-h":!0}),$(n)!=="svelte-89q1io"&&(n.textContent=y)},m(c,M){u(c,n,M)},p:Ve,d(c){c&&o(n)}}}function Ge(K){let n,y,c,M,j,oe,E,ke='A Diffusion Transformer model for 2D data from <a href="https://github.com/Tencent/HunyuanDiT" rel="nofollow">Hunyuan-DiT</a>.',re,q,se,r,L,ue,Q,Ce="HunYuanDiT: Diffusion model with a Transformer backbone.",fe,W,ze="Inherit ModelMixin and ConfigMixin to be compatible with the sampler StableDiffusionPipeline of diffusers.",pe,H,I,he,G,Pe=`Sets the attention processor to use <a href="https://huggingface.co/blog/reformer#2-chunked-feed-forward-layers" rel="nofollow">feed forward
chunking</a>.`,_e,w,A,ge,R,je='The <a href="/docs/diffusers/pr_8409/en/api/models/hunyuan_transformer2d#diffusers.HunyuanDiT2DModel">HunyuanDiT2DModel</a> forward method.',be,v,N,$e,Y,Ee=`Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, key, value)
are fused. For cross-attention modules, key and value projection matrices are fused.`,ye,k,ve,C,V,De,J,qe="Sets the attention processor to use to compute attention.",Te,z,S,xe,X,Le="Disables custom attention processors and sets the default attention implementation.",Me,D,O,He,Z,Ie="Disables the fused QKV projection if enabled.",we,P,ae,U,ie,ne,de;return j=new Ne({props:{title:"HunyuanDiT2DModel",local:"hunyuandit2dmodel",headingTag:"h1"}}),q=new Ne({props:{title:"HunyuanDiT2DModel",local:"diffusers.HunyuanDiT2DModel",headingTag:"h2"}}),L=new F({props:{name:"class diffusers.HunyuanDiT2DModel",anchor:"diffusers.HunyuanDiT2DModel",parameters:[{name:"num_attention_heads",val:": int = 16"},{name:"attention_head_dim",val:": int = 88"},{name:"in_channels",val:": Optional = None"},{name:"patch_size",val:": Optional = None"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"sample_size",val:" = 32"},{name:"hidden_size",val:" = 1152"},{name:"num_layers",val:": int = 28"},{name:"mlp_ratio",val:": float = 4.0"},{name:"learn_sigma",val:": bool = True"},{name:"cross_attention_dim",val:": int = 1024"},{name:"norm_type",val:": str = 'layer_norm'"},{name:"cross_attention_dim_t5",val:": int = 2048"},{name:"pooled_projection_dim",val:": int = 1024"},{name:"text_len",val:": int = 77"},{name:"text_len_t5",val:": int = 256"}],parametersDescription:[{anchor:"diffusers.HunyuanDiT2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.HunyuanDiT2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 88) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.HunyuanDiT2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of channels in the input and output (specify if the input is <strong>continuous</strong>).`,name:"in_channels"},{anchor:"diffusers.HunyuanDiT2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The size of the patch to use for the input.`,name:"patch_size"},{anchor:"diffusers.HunyuanDiT2DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;geglu&quot;</code>) &#x2014;
Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.HunyuanDiT2DModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The width of the latent images. This is fixed during training since it is used to learn a number of
position embeddings.`,name:"sample_size"},{anchor:"diffusers.HunyuanDiT2DModel.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability to use.`,name:"dropout"},{anchor:"diffusers.HunyuanDiT2DModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of dimension in the clip text embedding.`,name:"cross_attention_dim"},{anchor:"diffusers.HunyuanDiT2DModel.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The size of hidden layer in the conditioning embedding layers.`,name:"hidden_size"},{anchor:"diffusers.HunyuanDiT2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.HunyuanDiT2DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
The ratio of the hidden layer size to the input size.`,name:"mlp_ratio"},{anchor:"diffusers.HunyuanDiT2DModel.learn_sigma",description:`<strong>learn_sigma</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to predict variance.`,name:"learn_sigma"},{anchor:"diffusers.HunyuanDiT2DModel.cross_attention_dim_t5",description:`<strong>cross_attention_dim_t5</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number dimensions in t5 text embedding.`,name:"cross_attention_dim_t5"},{anchor:"diffusers.HunyuanDiT2DModel.pooled_projection_dim",description:`<strong>pooled_projection_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The size of the pooled projection.`,name:"pooled_projection_dim"},{anchor:"diffusers.HunyuanDiT2DModel.text_len",description:`<strong>text_len</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The length of the clip text embedding.`,name:"text_len"},{anchor:"diffusers.HunyuanDiT2DModel.text_len_t5",description:`<strong>text_len_t5</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The length of the T5 text embedding.`,name:"text_len_t5"}],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L212"}}),I=new F({props:{name:"enable_forward_chunking",anchor:"diffusers.HunyuanDiT2DModel.enable_forward_chunking",parameters:[{name:"chunk_size",val:": Optional = None"},{name:"dim",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.HunyuanDiT2DModel.enable_forward_chunking.chunk_size",description:`<strong>chunk_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The chunk size of the feed-forward layers. If not specified, will run feed-forward layer individually
over each tensor of dim=<code>dim</code>.`,name:"chunk_size"},{anchor:"diffusers.HunyuanDiT2DModel.enable_forward_chunking.dim",description:`<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) &#x2014;
The dimension over which the feed-forward computation should be chunked. Choose between dim=0 (batch)
or dim=1 (sequence length).`,name:"dim"}],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L535"}}),A=new F({props:{name:"forward",anchor:"diffusers.HunyuanDiT2DModel.forward",parameters:[{name:"hidden_states",val:""},{name:"timestep",val:""},{name:"encoder_hidden_states",val:" = None"},{name:"text_embedding_mask",val:" = None"},{name:"encoder_hidden_states_t5",val:" = None"},{name:"text_embedding_mask_t5",val:" = None"},{name:"image_meta_size",val:" = None"},{name:"style",val:" = None"},{name:"image_rotary_emb",val:" = None"},{name:"return_dict",val:" = True"}],parametersDescription:[{anchor:"diffusers.HunyuanDiT2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch size, dim, height, width)</code>) &#x2014;
The input tensor.`,name:"hidden_states"},{anchor:"diffusers.HunyuanDiT2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.HunyuanDiT2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> ( <code>torch.Tensor</code> of shape <code>(batch size, sequence len, embed dims)</code>, <em>optional</em>) &#x2014;
Conditional embeddings for cross attention layer. This is the output of <code>BertModel</code>.
text_embedding_mask &#x2014; torch.Tensor
An attention mask of shape <code>(batch, key_tokens)</code> is applied to <code>encoder_hidden_states</code>. This is the output
of <code>BertModel</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.HunyuanDiT2DModel.forward.encoder_hidden_states_t5",description:`<strong>encoder_hidden_states_t5</strong> ( <code>torch.Tensor</code> of shape <code>(batch size, sequence len, embed dims)</code>, <em>optional</em>) &#x2014;
Conditional embeddings for cross attention layer. This is the output of T5 Text Encoder.
text_embedding_mask_t5 &#x2014; torch.Tensor
An attention mask of shape <code>(batch, key_tokens)</code> is applied to <code>encoder_hidden_states</code>. This is the output
of T5 Text Encoder.`,name:"encoder_hidden_states_t5"},{anchor:"diffusers.HunyuanDiT2DModel.forward.image_meta_size",description:`<strong>image_meta_size</strong> (torch.Tensor) &#x2014;
Conditional embedding indicate the image sizes
style &#x2014; torch.Tensor:
Conditional embedding indicate the style`,name:"image_meta_size"},{anchor:"diffusers.HunyuanDiT2DModel.forward.image_rotary_emb",description:`<strong>image_rotary_emb</strong> (<code>torch.Tensor</code>) &#x2014;
The image rotary embeddings to apply on query and key tensors during attention calculation.
return_dict &#x2014; bool
Whether to return a dictionary.`,name:"image_rotary_emb"}],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L429"}}),N=new F({props:{name:"fuse_qkv_projections",anchor:"diffusers.HunyuanDiT2DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L326"}}),k=new Ae({props:{warning:!0,$$slots:{default:[Qe]},$$scope:{ctx:K}}}),V=new F({props:{name:"set_attn_processor",anchor:"diffusers.HunyuanDiT2DModel.set_attn_processor",parameters:[{name:"processor",val:": Union"}],parametersDescription:[{anchor:"diffusers.HunyuanDiT2DModel.set_attn_processor.processor",description:`<strong>processor</strong> (<code>dict</code> of <code>AttentionProcessor</code> or only <code>AttentionProcessor</code>) &#x2014;
The instantiated processor class or a dictionary of processor classes that will be set as the processor
for <strong>all</strong> <code>Attention</code> layers.</p>
<p>If <code>processor</code> is a dict, the key needs to define the path to the corresponding cross attention
processor. This is strongly recommended when setting trainable attention processors.`,name:"processor"}],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L389"}}),S=new F({props:{name:"set_default_attn_processor",anchor:"diffusers.HunyuanDiT2DModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L423"}}),O=new F({props:{name:"unfuse_qkv_projections",anchor:"diffusers.HunyuanDiT2DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8409/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L350"}}),P=new Ae({props:{warning:!0,$$slots:{default:[We]},$$scope:{ctx:K}}}),U=new Ke({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuan_transformer2d.md"}}),{c(){n=l("meta"),y=s(),c=l("p"),M=s(),f(j.$$.fragment),oe=s(),E=l("p"),E.innerHTML=ke,re=s(),f(q.$$.fragment),se=s(),r=l("div"),f(L.$$.fragment),ue=s(),Q=l("p"),Q.textContent=Ce,fe=s(),W=l("p"),W.textContent=ze,pe=s(),H=l("div"),f(I.$$.fragment),he=s(),G=l("p"),G.innerHTML=Pe,_e=s(),w=l("div"),f(A.$$.fragment),ge=s(),R=l("p"),R.innerHTML=je,be=s(),v=l("div"),f(N.$$.fragment),$e=s(),Y=l("p"),Y.textContent=Ee,ye=s(),f(k.$$.fragment),ve=s(),C=l("div"),f(V.$$.fragment),De=s(),J=l("p"),J.textContent=qe,Te=s(),z=l("div"),f(S.$$.fragment),xe=s(),X=l("p"),X.textContent=Le,Me=s(),D=l("div"),f(O.$$.fragment),He=s(),Z=l("p"),Z.textContent=Ie,we=s(),f(P.$$.fragment),ae=s(),f(U.$$.fragment),ie=s(),ne=l("p"),this.h()},l(e){const i=Fe("svelte-u9bgzb",document.head);n=m(i,"META",{name:!0,content:!0}),i.forEach(o),y=a(e),c=m(e,"P",{}),T(c).forEach(o),M=a(e),p(j.$$.fragment,e),oe=a(e),E=m(e,"P",{"data-svelte-h":!0}),$(E)!=="svelte-nkajjv"&&(E.innerHTML=ke),re=a(e),p(q.$$.fragment,e),se=a(e),r=m(e,"DIV",{class:!0});var d=T(r);p(L.$$.fragment,d),ue=a(d),Q=m(d,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-rv6x8u"&&(Q.textContent=Ce),fe=a(d),W=m(d,"P",{"data-svelte-h":!0}),$(W)!=="svelte-wuyqug"&&(W.textContent=ze),pe=a(d),H=m(d,"DIV",{class:!0});var B=T(H);p(I.$$.fragment,B),he=a(B),G=m(B,"P",{"data-svelte-h":!0}),$(G)!=="svelte-2m23sy"&&(G.innerHTML=Pe),B.forEach(o),_e=a(d),w=m(d,"DIV",{class:!0});var le=T(w);p(A.$$.fragment,le),ge=a(le),R=m(le,"P",{"data-svelte-h":!0}),$(R)!=="svelte-co3xka"&&(R.innerHTML=je),le.forEach(o),be=a(d),v=m(d,"DIV",{class:!0});var ee=T(v);p(N.$$.fragment,ee),$e=a(ee),Y=m(ee,"P",{"data-svelte-h":!0}),$(Y)!=="svelte-1254b9i"&&(Y.textContent=Ee),ye=a(ee),p(k.$$.fragment,ee),ee.forEach(o),ve=a(d),C=m(d,"DIV",{class:!0});var me=T(C);p(V.$$.fragment,me),De=a(me),J=m(me,"P",{"data-svelte-h":!0}),$(J)!=="svelte-1o77hl2"&&(J.textContent=qe),me.forEach(o),Te=a(d),z=m(d,"DIV",{class:!0});var ce=T(z);p(S.$$.fragment,ce),xe=a(ce),X=m(ce,"P",{"data-svelte-h":!0}),$(X)!=="svelte-1lxcwhv"&&(X.textContent=Le),ce.forEach(o),Me=a(d),D=m(d,"DIV",{class:!0});var te=T(D);p(O.$$.fragment,te),He=a(te),Z=m(te,"P",{"data-svelte-h":!0}),$(Z)!=="svelte-1vhtc74"&&(Z.textContent=Ie),we=a(te),p(P.$$.fragment,te),te.forEach(o),d.forEach(o),ae=a(e),p(U.$$.fragment,e),ie=a(e),ne=m(e,"P",{}),T(ne).forEach(o),this.h()},h(){x(n,"name","hf:doc:metadata"),x(n,"content",Re),x(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(r,"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,i){t(document.head,n),u(e,y,i),u(e,c,i),u(e,M,i),h(j,e,i),u(e,oe,i),u(e,E,i),u(e,re,i),h(q,e,i),u(e,se,i),u(e,r,i),h(L,r,null),t(r,ue),t(r,Q),t(r,fe),t(r,W),t(r,pe),t(r,H),h(I,H,null),t(H,he),t(H,G),t(r,_e),t(r,w),h(A,w,null),t(w,ge),t(w,R),t(r,be),t(r,v),h(N,v,null),t(v,$e),t(v,Y),t(v,ye),h(k,v,null),t(r,ve),t(r,C),h(V,C,null),t(C,De),t(C,J),t(r,Te),t(r,z),h(S,z,null),t(z,xe),t(z,X),t(r,Me),t(r,D),h(O,D,null),t(D,He),t(D,Z),t(D,we),h(P,D,null),u(e,ae,i),h(U,e,i),u(e,ie,i),u(e,ne,i),de=!0},p(e,[i]){const d={};i&2&&(d.$$scope={dirty:i,ctx:e}),k.$set(d);const B={};i&2&&(B.$$scope={dirty:i,ctx:e}),P.$set(B)},i(e){de||(_(j.$$.fragment,e),_(q.$$.fragment,e),_(L.$$.fragment,e),_(I.$$.fragment,e),_(A.$$.fragment,e),_(N.$$.fragment,e),_(k.$$.fragment,e),_(V.$$.fragment,e),_(S.$$.fragment,e),_(O.$$.fragment,e),_(P.$$.fragment,e),_(U.$$.fragment,e),de=!0)},o(e){g(j.$$.fragment,e),g(q.$$.fragment,e),g(L.$$.fragment,e),g(I.$$.fragment,e),g(A.$$.fragment,e),g(N.$$.fragment,e),g(k.$$.fragment,e),g(V.$$.fragment,e),g(S.$$.fragment,e),g(O.$$.fragment,e),g(P.$$.fragment,e),g(U.$$.fragment,e),de=!1},d(e){e&&(o(y),o(c),o(M),o(oe),o(E),o(re),o(se),o(r),o(ae),o(ie),o(ne)),o(n),b(j,e),b(q,e),b(L),b(I),b(A),b(N),b(k),b(V),b(S),b(O),b(P),b(U,e)}}}const Re='{"title":"HunyuanDiT2DModel","local":"hunyuandit2dmodel","sections":[{"title":"HunyuanDiT2DModel","local":"diffusers.HunyuanDiT2DModel","sections":[],"depth":2}],"depth":1}';function Ye(K){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nt extends Ue{constructor(n){super(),Be(this,n,Ye,Ge,Se,{})}}export{nt as component};
