import{s as Z,n as ee,o as ne}from"../chunks/scheduler.182ea377.js";import{S as te,i as oe,g as d,s as i,r as M,A as ie,h as m,f as t,c as a,j as I,u as H,x as O,k as B,y as l,a as s,v as $,d as w,t as z,w as k}from"../chunks/index.abf12888.js";import{D as Q}from"../chunks/Docstring.b0ac41bc.js";import{H as X,E as ae}from"../chunks/EditOnGithub.9b8e78e4.js";function se(R){let r,C,x,P,f,E,h,Y='A Diffusion Transformer model for 2D data from <a href="https://github.com/Tencent/HunyuanDiT" rel="nofollow">Hunyuan-DiT</a>.',N,_,j,o,p,U,D,F="HunYuanDiT: Diffusion model with a Transformer backbone.",V,y,J="Inherit ModelMixin and ConfigMixin to be compatible with the sampler StableDiffusionPipeline of diffusers.",W,c,g,G,b,K='The <a href="/docs/diffusers/v0.28.1/en/api/models/hunyuan_transformer_2d#diffusers.HunyuanDiT2DModel">HunyuanDiT2DModel</a> forward method.',L,T,q,v,A;return f=new X({props:{title:"HunyuanDiT2DModel",local:"hunyuandit2dmodel",headingTag:"h1"}}),_=new X({props:{title:"HunyuanDiT2DModel",local:"diffusers.HunyuanDiT2DModel",headingTag:"h2"}}),p=new Q({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/v0.28.1/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L211"}}),g=new Q({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/v0.28.1/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L324"}}),T=new ae({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuan_transformer_2d.md"}}),{c(){r=d("meta"),C=i(),x=d("p"),P=i(),M(f.$$.fragment),E=i(),h=d("p"),h.innerHTML=Y,N=i(),M(_.$$.fragment),j=i(),o=d("div"),M(p.$$.fragment),U=i(),D=d("p"),D.textContent=F,V=i(),y=d("p"),y.textContent=J,W=i(),c=d("div"),M(g.$$.fragment),G=i(),b=d("p"),b.innerHTML=K,L=i(),M(T.$$.fragment),q=i(),v=d("p"),this.h()},l(e){const n=ie("svelte-u9bgzb",document.head);r=m(n,"META",{name:!0,content:!0}),n.forEach(t),C=a(e),x=m(e,"P",{}),I(x).forEach(t),P=a(e),H(f.$$.fragment,e),E=a(e),h=m(e,"P",{"data-svelte-h":!0}),O(h)!=="svelte-nkajjv"&&(h.innerHTML=Y),N=a(e),H(_.$$.fragment,e),j=a(e),o=m(e,"DIV",{class:!0});var u=I(o);H(p.$$.fragment,u),U=a(u),D=m(u,"P",{"data-svelte-h":!0}),O(D)!=="svelte-rv6x8u"&&(D.textContent=F),V=a(u),y=m(u,"P",{"data-svelte-h":!0}),O(y)!=="svelte-wuyqug"&&(y.textContent=J),W=a(u),c=m(u,"DIV",{class:!0});var S=I(c);H(g.$$.fragment,S),G=a(S),b=m(S,"P",{"data-svelte-h":!0}),O(b)!=="svelte-1r86kha"&&(b.innerHTML=K),S.forEach(t),u.forEach(t),L=a(e),H(T.$$.fragment,e),q=a(e),v=m(e,"P",{}),I(v).forEach(t),this.h()},h(){B(r,"name","hf:doc:metadata"),B(r,"content",re),B(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(o,"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,n){l(document.head,r),s(e,C,n),s(e,x,n),s(e,P,n),$(f,e,n),s(e,E,n),s(e,h,n),s(e,N,n),$(_,e,n),s(e,j,n),s(e,o,n),$(p,o,null),l(o,U),l(o,D),l(o,V),l(o,y),l(o,W),l(o,c),$(g,c,null),l(c,G),l(c,b),s(e,L,n),$(T,e,n),s(e,q,n),s(e,v,n),A=!0},p:ee,i(e){A||(w(f.$$.fragment,e),w(_.$$.fragment,e),w(p.$$.fragment,e),w(g.$$.fragment,e),w(T.$$.fragment,e),A=!0)},o(e){z(f.$$.fragment,e),z(_.$$.fragment,e),z(p.$$.fragment,e),z(g.$$.fragment,e),z(T.$$.fragment,e),A=!1},d(e){e&&(t(C),t(x),t(P),t(E),t(h),t(N),t(j),t(o),t(L),t(q),t(v)),t(r),k(f,e),k(_,e),k(p),k(g),k(T,e)}}}const re='{"title":"HunyuanDiT2DModel","local":"hunyuandit2dmodel","sections":[{"title":"HunyuanDiT2DModel","local":"diffusers.HunyuanDiT2DModel","sections":[],"depth":2}],"depth":1}';function de(R){return ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends te{constructor(r){super(),oe(this,r,de,se,Z,{})}}export{fe as component};
