import{s as Fe,o as ye,n as we}from"../chunks/scheduler.8c3d61f6.js";import{S as je,i as ke,g as c,s as a,r as _,A as Ce,h as f,f as r,c as i,j as z,u as g,x as T,k as H,y as o,a as m,v as b,d as $,t as x,w as v}from"../chunks/index.da70eac4.js";import{T as De}from"../chunks/Tip.1d9b8c37.js";import{D as J}from"../chunks/Docstring.6b390b9a.js";import{H as Me,E as Pe}from"../chunks/EditOnGithub.1e64e623.js";function Le(V){let t,u="This API is 🧪 experimental.";return{c(){t=c("p"),t.textContent=u},l(d){t=f(d,"P",{"data-svelte-h":!0}),T(t)!=="svelte-89q1io"&&(t.textContent=u)},m(d,D){m(d,t,D)},p:we,d(d){d&&r(t)}}}function Ee(V){let t,u="This API is 🧪 experimental.";return{c(){t=c("p"),t.textContent=u},l(d){t=f(d,"P",{"data-svelte-h":!0}),T(t)!=="svelte-89q1io"&&(t.textContent=u)},m(d,D){m(d,t,D)},p:we,d(d){d&&r(t)}}}function Ae(V){let t,u,d,D,j,X,k,_e='A Transformer model for image-like data from <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">Flux</a>.',Y,C,Z,s,P,re,O,ge="The Transformer model introduced in Flux.",se,S,be='Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a>',ae,M,L,ie,U,$e='The <a href="/docs/diffusers/pr_6247/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',de,p,E,le,K,xe=`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.`,ce,w,fe,F,A,me,Q,ve="Sets the attention processor to use to compute attention.",ue,h,I,pe,R,Te="Disables the fused QKV projection if enabled.",he,y,ee,N,te,B,oe;return j=new Me({props:{title:"FluxTransformer2DModel",local:"fluxtransformer2dmodel",headingTag:"h1"}}),C=new Me({props:{title:"FluxTransformer2DModel",local:"diffusers.FluxTransformer2DModel",headingTag:"h2"}}),P=new J({props:{name:"class diffusers.FluxTransformer2DModel",anchor:"diffusers.FluxTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"num_layers",val:": int = 19"},{name:"num_single_layers",val:": int = 38"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 24"},{name:"joint_attention_dim",val:": int = 4096"},{name:"pooled_projection_dim",val:": int = 768"},{name:"guidance_embeds",val:": bool = False"},{name:"axes_dims_rope",val:": Tuple = (16, 56, 56)"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.patch_size",description:"<strong>patch_size</strong> (<code>int</code>) &#x2014; Patch size to turn the input data into small patches.",name:"patch_size"},{anchor:"diffusers.FluxTransformer2DModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014; The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.FluxTransformer2DModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of layers of MMDiT blocks to use.",name:"num_layers"},{anchor:"diffusers.FluxTransformer2DModel.num_single_layers",description:"<strong>num_single_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of layers of single DiT blocks to use.",name:"num_single_layers"},{anchor:"diffusers.FluxTransformer2DModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014; The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.FluxTransformer2DModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.FluxTransformer2DModel.joint_attention_dim",description:"<strong>joint_attention_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The number of <code>encoder_hidden_states</code> dimensions to use.",name:"joint_attention_dim"},{anchor:"diffusers.FluxTransformer2DModel.pooled_projection_dim",description:"<strong>pooled_projection_dim</strong> (<code>int</code>) &#x2014; Number of dimensions to use when projecting the <code>pooled_projections</code>.",name:"pooled_projection_dim"},{anchor:"diffusers.FluxTransformer2DModel.guidance_embeds",description:"<strong>guidance_embeds</strong> (<code>bool</code>, defaults to False) &#x2014; Whether to use guidance embeddings.",name:"guidance_embeds"}],source:"https://github.com/huggingface/diffusers/blob/vr_6247/src/diffusers/models/transformers/transformer_flux.py#L215"}}),L=new J({props:{name:"forward",anchor:"diffusers.FluxTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"pooled_projections",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"img_ids",val:": Tensor = None"},{name:"txt_ids",val:": Tensor = None"},{name:"guidance",val:": Tensor = None"},{name:"joint_attention_kwargs",val:": Optional = None"},{name:"controlnet_block_samples",val:" = None"},{name:"controlnet_single_block_samples",val:" = None"},{name:"return_dict",val:": bool = True"},{name:"controlnet_blocks_repeat",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, channel, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.FluxTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, sequence_len, embed_dims)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.FluxTransformer2DModel.forward.pooled_projections",description:`<strong>pooled_projections</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, projection_dim)</code>) &#x2014; Embeddings projected
from the embeddings of input conditions.`,name:"pooled_projections"},{anchor:"diffusers.FluxTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.
block_controlnet_hidden_states &#x2014; (<code>list</code> of <code>torch.Tensor</code>):
A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"timestep"},{anchor:"diffusers.FluxTransformer2DModel.forward.joint_attention_kwargs",description:`<strong>joint_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"joint_attention_kwargs"},{anchor:"diffusers.FluxTransformer2DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain
tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_6247/src/diffusers/models/transformers/transformer_flux.py#L397",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise a
<code>tuple</code> where the first element is the sample tensor.</p>
`}}),E=new J({props:{name:"fuse_qkv_projections",anchor:"diffusers.FluxTransformer2DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_6247/src/diffusers/models/transformers/transformer_flux.py#L354"}}),w=new De({props:{warning:!0,$$slots:{default:[Le]},$$scope:{ctx:V}}}),A=new J({props:{name:"set_attn_processor",anchor:"diffusers.FluxTransformer2DModel.set_attn_processor",parameters:[{name:"processor",val:": Union"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.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_6247/src/diffusers/models/transformers/transformer_flux.py#L319"}}),I=new J({props:{name:"unfuse_qkv_projections",anchor:"diffusers.FluxTransformer2DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_6247/src/diffusers/models/transformers/transformer_flux.py#L380"}}),y=new De({props:{warning:!0,$$slots:{default:[Ee]},$$scope:{ctx:V}}}),N=new Pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux_transformer.md"}}),{c(){t=c("meta"),u=a(),d=c("p"),D=a(),_(j.$$.fragment),X=a(),k=c("p"),k.innerHTML=_e,Y=a(),_(C.$$.fragment),Z=a(),s=c("div"),_(P.$$.fragment),re=a(),O=c("p"),O.textContent=ge,se=a(),S=c("p"),S.innerHTML=be,ae=a(),M=c("div"),_(L.$$.fragment),ie=a(),U=c("p"),U.innerHTML=$e,de=a(),p=c("div"),_(E.$$.fragment),le=a(),K=c("p"),K.textContent=xe,ce=a(),_(w.$$.fragment),fe=a(),F=c("div"),_(A.$$.fragment),me=a(),Q=c("p"),Q.textContent=ve,ue=a(),h=c("div"),_(I.$$.fragment),pe=a(),R=c("p"),R.textContent=Te,he=a(),_(y.$$.fragment),ee=a(),_(N.$$.fragment),te=a(),B=c("p"),this.h()},l(e){const n=Ce("svelte-u9bgzb",document.head);t=f(n,"META",{name:!0,content:!0}),n.forEach(r),u=i(e),d=f(e,"P",{}),z(d).forEach(r),D=i(e),g(j.$$.fragment,e),X=i(e),k=f(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-e6h9db"&&(k.innerHTML=_e),Y=i(e),g(C.$$.fragment,e),Z=i(e),s=f(e,"DIV",{class:!0});var l=z(s);g(P.$$.fragment,l),re=i(l),O=f(l,"P",{"data-svelte-h":!0}),T(O)!=="svelte-19p4ty0"&&(O.textContent=ge),se=i(l),S=f(l,"P",{"data-svelte-h":!0}),T(S)!=="svelte-mxgguy"&&(S.innerHTML=be),ae=i(l),M=f(l,"DIV",{class:!0});var q=z(M);g(L.$$.fragment,q),ie=i(q),U=f(q,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1kfbf5"&&(U.innerHTML=$e),q.forEach(r),de=i(l),p=f(l,"DIV",{class:!0});var W=z(p);g(E.$$.fragment,W),le=i(W),K=f(W,"P",{"data-svelte-h":!0}),T(K)!=="svelte-1254b9i"&&(K.textContent=xe),ce=i(W),g(w.$$.fragment,W),W.forEach(r),fe=i(l),F=f(l,"DIV",{class:!0});var ne=z(F);g(A.$$.fragment,ne),me=i(ne),Q=f(ne,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-1o77hl2"&&(Q.textContent=ve),ne.forEach(r),ue=i(l),h=f(l,"DIV",{class:!0});var G=z(h);g(I.$$.fragment,G),pe=i(G),R=f(G,"P",{"data-svelte-h":!0}),T(R)!=="svelte-1vhtc74"&&(R.textContent=Te),he=i(G),g(y.$$.fragment,G),G.forEach(r),l.forEach(r),ee=i(e),g(N.$$.fragment,e),te=i(e),B=f(e,"P",{}),z(B).forEach(r),this.h()},h(){H(t,"name","hf:doc:metadata"),H(t,"content",Ie),H(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(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,n){o(document.head,t),m(e,u,n),m(e,d,n),m(e,D,n),b(j,e,n),m(e,X,n),m(e,k,n),m(e,Y,n),b(C,e,n),m(e,Z,n),m(e,s,n),b(P,s,null),o(s,re),o(s,O),o(s,se),o(s,S),o(s,ae),o(s,M),b(L,M,null),o(M,ie),o(M,U),o(s,de),o(s,p),b(E,p,null),o(p,le),o(p,K),o(p,ce),b(w,p,null),o(s,fe),o(s,F),b(A,F,null),o(F,me),o(F,Q),o(s,ue),o(s,h),b(I,h,null),o(h,pe),o(h,R),o(h,he),b(y,h,null),m(e,ee,n),b(N,e,n),m(e,te,n),m(e,B,n),oe=!0},p(e,[n]){const l={};n&2&&(l.$$scope={dirty:n,ctx:e}),w.$set(l);const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),y.$set(q)},i(e){oe||($(j.$$.fragment,e),$(C.$$.fragment,e),$(P.$$.fragment,e),$(L.$$.fragment,e),$(E.$$.fragment,e),$(w.$$.fragment,e),$(A.$$.fragment,e),$(I.$$.fragment,e),$(y.$$.fragment,e),$(N.$$.fragment,e),oe=!0)},o(e){x(j.$$.fragment,e),x(C.$$.fragment,e),x(P.$$.fragment,e),x(L.$$.fragment,e),x(E.$$.fragment,e),x(w.$$.fragment,e),x(A.$$.fragment,e),x(I.$$.fragment,e),x(y.$$.fragment,e),x(N.$$.fragment,e),oe=!1},d(e){e&&(r(u),r(d),r(D),r(X),r(k),r(Y),r(Z),r(s),r(ee),r(te),r(B)),r(t),v(j,e),v(C,e),v(P),v(L),v(E),v(w),v(A),v(I),v(y),v(N,e)}}}const Ie='{"title":"FluxTransformer2DModel","local":"fluxtransformer2dmodel","sections":[{"title":"FluxTransformer2DModel","local":"diffusers.FluxTransformer2DModel","sections":[],"depth":2}],"depth":1}';function Ne(V){return ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends je{constructor(t){super(),ke(this,t,Ne,Ae,Fe,{})}}export{Se as component};
