Buckets:
| import{s as je,n as Ne,o as Ie}from"../chunks/scheduler.53228c21.js";import{S as Ae,i as Ve,e as i,s as n,c as f,h as Se,a as d,d as o,b as s,f as M,g as _,j as h,k as p,l as t,m,n as g,t as y,o as b,p as T}from"../chunks/index.cac5d66a.js";import{C as Oe}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as G}from"../chunks/Docstring.9de32ff4.js";import{H as Pe,E as Be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function Ke(xe){let D,J,R,X,H,Z,w,ee,k,$e='A Diffusion Transformer model for 2D data from <a href="https://github.com/Tencent/HunyuanDiT" rel="nofollow">Hunyuan-DiT</a>.',te,z,ne,r,C,le,V,Me="HunYuanDiT: Diffusion model with a Transformer backbone.",me,S,He="Inherit ModelMixin and ConfigMixin to be compatible with the sampler StableDiffusionPipeline of diffusers.",ue,v,L,ce,O,we=`Sets the attention processor to use <a href="https://huggingface.co/blog/reformer#2-chunked-feed-forward-layers" rel="nofollow">feed forward | |
| chunking</a>.`,fe,x,q,_e,B,ke='The <a href="/docs/diffusers/pr_13921/en/api/models/hunyuan_transformer2d#diffusers.HunyuanDiT2DModel">HunyuanDiT2DModel</a> forward method.',he,u,E,pe,K,ze=`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.`,ge,P,Ce="<p>> This API is 🧪 experimental.</p>",ye,$,j,be,Q,Le="Disables custom attention processors and sets the default attention implementation.",Te,c,N,De,U,qe="Disables the fused QKV projection if enabled.",ve,I,Ee="<p>> This API is 🧪 experimental.</p>",oe,A,se,Y,re;return H=new Oe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new Pe({props:{title:"HunyuanDiT2DModel",local:"hunyuandit2dmodel",headingTag:"h1"}}),z=new Pe({props:{title:"HunyuanDiT2DModel",local:"diffusers.HunyuanDiT2DModel",headingTag:"h2"}}),C=new G({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:": int | None = None"},{name:"patch_size",val:": int | None = 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"},{name:"use_style_cond_and_image_meta_size",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.HunyuanDiT2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) — | |
| 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) — | |
| 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>) — | |
| 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>) — | |
| 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>"geglu"</code>) — | |
| 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>) — | |
| 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) — | |
| 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>) — | |
| 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>) — | |
| 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) — | |
| 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) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| The length of the T5 text embedding.`,name:"text_len_t5"},{anchor:"diffusers.HunyuanDiT2DModel.use_style_cond_and_image_meta_size",description:`<strong>use_style_cond_and_image_meta_size</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to use style condition and image meta size. True for version <=1.1, False for version >= 1.2`,name:"use_style_cond_and_image_meta_size"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L201"}}),L=new G({props:{name:"enable_forward_chunking",anchor:"diffusers.HunyuanDiT2DModel.enable_forward_chunking",parameters:[{name:"chunk_size",val:": int | None = 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>) — | |
| 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>) — | |
| 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_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L472"}}),q=new G({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:"controlnet_block_samples",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>) — | |
| The input tensor.`,name:"hidden_states"},{anchor:"diffusers.HunyuanDiT2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>, <em>optional</em>) — | |
| 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>) — | |
| Conditional embeddings for cross attention layer. This is the output of <code>BertModel</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.HunyuanDiT2DModel.forward.text_embedding_mask",description:`<strong>text_embedding_mask</strong> — 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:"text_embedding_mask"},{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>) — | |
| Conditional embeddings for cross attention layer. This is the output of T5 Text Encoder.`,name:"encoder_hidden_states_t5"},{anchor:"diffusers.HunyuanDiT2DModel.forward.text_embedding_mask_t5",description:`<strong>text_embedding_mask_t5</strong> — 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:"text_embedding_mask_t5"},{anchor:"diffusers.HunyuanDiT2DModel.forward.image_meta_size",description:`<strong>image_meta_size</strong> (torch.Tensor) — | |
| Conditional embedding indicate the image sizes`,name:"image_meta_size"},{anchor:"diffusers.HunyuanDiT2DModel.forward.style",description:`<strong>style</strong> — torch.Tensor: | |
| Conditional embedding indicate the style`,name:"style"},{anchor:"diffusers.HunyuanDiT2DModel.forward.image_rotary_emb",description:`<strong>image_rotary_emb</strong> (<code>torch.Tensor</code>) — | |
| The image rotary embeddings to apply on query and key tensors during attention calculation.`,name:"image_rotary_emb"},{anchor:"diffusers.HunyuanDiT2DModel.forward.controlnet_block_samples",description:`<strong>controlnet_block_samples</strong> (<code>list</code> of <code>torch.Tensor</code>, <em>optional</em>) — | |
| A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"controlnet_block_samples"},{anchor:"diffusers.HunyuanDiT2DModel.forward.return_dict",description:`<strong>return_dict</strong> — bool | |
| Whether to return a dictionary.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L357"}}),E=new G({props:{name:"fuse_qkv_projections",anchor:"diffusers.HunyuanDiT2DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L320"}}),j=new G({props:{name:"set_default_attn_processor",anchor:"diffusers.HunyuanDiT2DModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L351"}}),N=new G({props:{name:"unfuse_qkv_projections",anchor:"diffusers.HunyuanDiT2DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/hunyuan_transformer_2d.py#L342"}}),A=new Be({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuan_transformer2d.md"}}),{c(){D=i("meta"),J=n(),R=i("p"),X=n(),f(H.$$.fragment),Z=n(),f(w.$$.fragment),ee=n(),k=i("p"),k.innerHTML=$e,te=n(),f(z.$$.fragment),ne=n(),r=i("div"),f(C.$$.fragment),le=n(),V=i("p"),V.textContent=Me,me=n(),S=i("p"),S.textContent=He,ue=n(),v=i("div"),f(L.$$.fragment),ce=n(),O=i("p"),O.innerHTML=we,fe=n(),x=i("div"),f(q.$$.fragment),_e=n(),B=i("p"),B.innerHTML=ke,he=n(),u=i("div"),f(E.$$.fragment),pe=n(),K=i("p"),K.textContent=ze,ge=n(),P=i("blockquote"),P.innerHTML=Ce,ye=n(),$=i("div"),f(j.$$.fragment),be=n(),Q=i("p"),Q.textContent=Le,Te=n(),c=i("div"),f(N.$$.fragment),De=n(),U=i("p"),U.textContent=qe,ve=n(),I=i("blockquote"),I.innerHTML=Ee,oe=n(),f(A.$$.fragment),se=n(),Y=i("p"),this.h()},l(e){const a=Se("svelte-u9bgzb",document.head);D=d(a,"META",{name:!0,content:!0}),a.forEach(o),J=s(e),R=d(e,"P",{}),M(R).forEach(o),X=s(e),_(H.$$.fragment,e),Z=s(e),_(w.$$.fragment,e),ee=s(e),k=d(e,"P",{"data-svelte-h":!0}),h(k)!=="svelte-nkajjv"&&(k.innerHTML=$e),te=s(e),_(z.$$.fragment,e),ne=s(e),r=d(e,"DIV",{class:!0});var l=M(r);_(C.$$.fragment,l),le=s(l),V=d(l,"P",{"data-svelte-h":!0}),h(V)!=="svelte-rv6x8u"&&(V.textContent=Me),me=s(l),S=d(l,"P",{"data-svelte-h":!0}),h(S)!=="svelte-wuyqug"&&(S.textContent=He),ue=s(l),v=d(l,"DIV",{class:!0});var ae=M(v);_(L.$$.fragment,ae),ce=s(ae),O=d(ae,"P",{"data-svelte-h":!0}),h(O)!=="svelte-2m23sy"&&(O.innerHTML=we),ae.forEach(o),fe=s(l),x=d(l,"DIV",{class:!0});var ie=M(x);_(q.$$.fragment,ie),_e=s(ie),B=d(ie,"P",{"data-svelte-h":!0}),h(B)!=="svelte-150sl73"&&(B.innerHTML=ke),ie.forEach(o),he=s(l),u=d(l,"DIV",{class:!0});var F=M(u);_(E.$$.fragment,F),pe=s(F),K=d(F,"P",{"data-svelte-h":!0}),h(K)!=="svelte-1254b9i"&&(K.textContent=ze),ge=s(F),P=d(F,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),h(P)!=="svelte-6y4o4y"&&(P.innerHTML=Ce),F.forEach(o),ye=s(l),$=d(l,"DIV",{class:!0});var de=M($);_(j.$$.fragment,de),be=s(de),Q=d(de,"P",{"data-svelte-h":!0}),h(Q)!=="svelte-1lxcwhv"&&(Q.textContent=Le),de.forEach(o),Te=s(l),c=d(l,"DIV",{class:!0});var W=M(c);_(N.$$.fragment,W),De=s(W),U=d(W,"P",{"data-svelte-h":!0}),h(U)!=="svelte-1vhtc74"&&(U.textContent=qe),ve=s(W),I=d(W,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),h(I)!=="svelte-6y4o4y"&&(I.innerHTML=Ee),W.forEach(o),l.forEach(o),oe=s(e),_(A.$$.fragment,e),se=s(e),Y=d(e,"P",{}),M(Y).forEach(o),this.h()},h(){p(D,"name","hf:doc:metadata"),p(D,"content",Qe),p(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(P,"class","warning"),p(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(I,"class","warning"),p(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(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,a){t(document.head,D),m(e,J,a),m(e,R,a),m(e,X,a),g(H,e,a),m(e,Z,a),g(w,e,a),m(e,ee,a),m(e,k,a),m(e,te,a),g(z,e,a),m(e,ne,a),m(e,r,a),g(C,r,null),t(r,le),t(r,V),t(r,me),t(r,S),t(r,ue),t(r,v),g(L,v,null),t(v,ce),t(v,O),t(r,fe),t(r,x),g(q,x,null),t(x,_e),t(x,B),t(r,he),t(r,u),g(E,u,null),t(u,pe),t(u,K),t(u,ge),t(u,P),t(r,ye),t(r,$),g(j,$,null),t($,be),t($,Q),t(r,Te),t(r,c),g(N,c,null),t(c,De),t(c,U),t(c,ve),t(c,I),m(e,oe,a),g(A,e,a),m(e,se,a),m(e,Y,a),re=!0},p:Ne,i(e){re||(y(H.$$.fragment,e),y(w.$$.fragment,e),y(z.$$.fragment,e),y(C.$$.fragment,e),y(L.$$.fragment,e),y(q.$$.fragment,e),y(E.$$.fragment,e),y(j.$$.fragment,e),y(N.$$.fragment,e),y(A.$$.fragment,e),re=!0)},o(e){b(H.$$.fragment,e),b(w.$$.fragment,e),b(z.$$.fragment,e),b(C.$$.fragment,e),b(L.$$.fragment,e),b(q.$$.fragment,e),b(E.$$.fragment,e),b(j.$$.fragment,e),b(N.$$.fragment,e),b(A.$$.fragment,e),re=!1},d(e){e&&(o(J),o(R),o(X),o(Z),o(ee),o(k),o(te),o(ne),o(r),o(oe),o(se),o(Y)),o(D),T(H,e),T(w,e),T(z,e),T(C),T(L),T(q),T(E),T(j),T(N),T(A,e)}}}const Qe='{"title":"HunyuanDiT2DModel","local":"hunyuandit2dmodel","sections":[{"title":"HunyuanDiT2DModel","local":"diffusers.HunyuanDiT2DModel","sections":[],"depth":2}],"depth":1}';function Ue(xe){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Je extends Ae{constructor(D){super(),Ve(this,D,Ue,Ke,je,{})}}export{Je as component}; | |
Xet Storage Details
- Size:
- 16.9 kB
- Xet hash:
- 7af073960d4d4420a2518ea5b89eea020a9eda48e430c2516f9e16b499717512
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.