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 as r,r as f,A as Fe,h as m,f as o,c as a,j as v,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>.',se,q,re,s,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/main/en/api/models/hunyuan_transformer2d#diffusers.HunyuanDiT2DModel">HunyuanDiT2DModel</a> forward method.',be,D,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,De,C,V,Te,J,qe="Sets the attention processor to use to compute attention.",ve,z,S,xe,X,Le="Disables custom attention processors and sets the default attention implementation.",Me,T,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/main/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/main/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/main/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/main/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/main/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/main/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/main/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=r(),c=l("p"),M=r(),f(j.$$.fragment),oe=r(),E=l("p"),E.innerHTML=ke,se=r(),f(q.$$.fragment),re=r(),s=l("div"),f(L.$$.fragment),ue=r(),Q=l("p"),Q.textContent=Ce,fe=r(),W=l("p"),W.textContent=ze,pe=r(),H=l("div"),f(I.$$.fragment),he=r(),G=l("p"),G.innerHTML=Pe,_e=r(),w=l("div"),f(A.$$.fragment),ge=r(),R=l("p"),R.innerHTML=je,be=r(),D=l("div"),f(N.$$.fragment),$e=r(),Y=l("p"),Y.textContent=Ee,ye=r(),f(k.$$.fragment),De=r(),C=l("div"),f(V.$$.fragment),Te=r(),J=l("p"),J.textContent=qe,ve=r(),z=l("div"),f(S.$$.fragment),xe=r(),X=l("p"),X.textContent=Le,Me=r(),T=l("div"),f(O.$$.fragment),He=r(),Z=l("p"),Z.textContent=Ie,we=r(),f(P.$$.fragment),ae=r(),f(U.$$.fragment),ie=r(),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",{}),v(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),se=a(e),p(q.$$.fragment,e),re=a(e),s=m(e,"DIV",{class:!0});var d=v(s);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=v(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=v(w);p(A.$$.fragment,le),ge=a(le),R=m(le,"P",{"data-svelte-h":!0}),$(R)!=="svelte-eoo91"&&(R.innerHTML=je),le.forEach(o),be=a(d),D=m(d,"DIV",{class:!0});var ee=v(D);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),De=a(d),C=m(d,"DIV",{class:!0});var me=v(C);p(V.$$.fragment,me),Te=a(me),J=m(me,"P",{"data-svelte-h":!0}),$(J)!=="svelte-1o77hl2"&&(J.textContent=qe),me.forEach(o),ve=a(d),z=m(d,"DIV",{class:!0});var ce=v(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),T=m(d,"DIV",{class:!0});var te=v(T);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",{}),v(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(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(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(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(s,"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,se,i),h(q,e,i),u(e,re,i),u(e,s,i),h(L,s,null),t(s,ue),t(s,Q),t(s,fe),t(s,W),t(s,pe),t(s,H),h(I,H,null),t(H,he),t(H,G),t(s,_e),t(s,w),h(A,w,null),t(w,ge),t(w,R),t(s,be),t(s,D),h(N,D,null),t(D,$e),t(D,Y),t(D,ye),h(k,D,null),t(s,De),t(s,C),h(V,C,null),t(C,Te),t(C,J),t(s,ve),t(s,z),h(S,z,null),t(z,xe),t(z,X),t(s,Me),t(s,T),h(O,T,null),t(T,He),t(T,Z),t(T,we),h(P,T,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(se),o(re),o(s),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};
