import{s as Z,n as ee,o as ne}from"../chunks/scheduler.8c3d61f6.js";import{S as oe,i as te,g as i,s as r,r as M,A as re,h as l,f as o,c as s,j as O,u as F,x as q,k as S,y as c,a,v as w,d as y,t as j,w as k}from"../chunks/index.da70eac4.js";import{D as X}from"../chunks/Docstring.91dd4639.js";import{H as Y,E as se}from"../chunks/getInferenceSnippets.28ca3596.js";function ae(G){let d,P,$,L,u,N,p,B='A Transformer model for image-like data from <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">Flux</a>.',z,_,E,t,h,R,b,J="The Transformer model introduced in Flux.",U,T,K='Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a>',V,m,g,W,v,Q='The <a href="/docs/diffusers/main/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',C,x,H,D,A;return u=new Y({props:{title:"FluxTransformer2DModel",local:"fluxtransformer2dmodel",headingTag:"h1"}}),_=new Y({props:{title:"FluxTransformer2DModel",local:"diffusers.FluxTransformer2DModel",headingTag:"h2"}}),h=new X({props:{name:"class diffusers.FluxTransformer2DModel",anchor:"diffusers.FluxTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": typing.Optional[int] = None"},{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:": typing.Tuple[int, int, int] = (16, 56, 56)"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>1</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>, defaults to <code>64</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.FluxTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of channels in the output. If not specified, it defaults to <code>in_channels</code>.`,name:"out_channels"},{anchor:"diffusers.FluxTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>19</code>) &#x2014;
The number of layers of dual stream DiT blocks to use.`,name:"num_layers"},{anchor:"diffusers.FluxTransformer2DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>38</code>) &#x2014;
The number of layers of single stream DiT blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.FluxTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of dimensions to use for each attention head.`,name:"attention_head_dim"},{anchor:"diffusers.FluxTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of attention heads to use.`,name:"num_attention_heads"},{anchor:"diffusers.FluxTransformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
The number of dimensions to use for the joint attention (embedding/channel dimension of
<code>encoder_hidden_states</code>).`,name:"joint_attention_dim"},{anchor:"diffusers.FluxTransformer2DModel.pooled_projection_dim",description:`<strong>pooled_projection_dim</strong> (<code>int</code>, defaults to <code>768</code>) &#x2014;
The number of dimensions to use for the pooled projection.`,name:"pooled_projection_dim"},{anchor:"diffusers.FluxTransformer2DModel.guidance_embeds",description:`<strong>guidance_embeds</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to use guidance embeddings for guidance-distilled variant of the model.`,name:"guidance_embeds"},{anchor:"diffusers.FluxTransformer2DModel.axes_dims_rope",description:`<strong>axes_dims_rope</strong> (<code>Tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The dimensions to use for the rotary positional embeddings.`,name:"axes_dims_rope"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_flux.py#L515"}}),g=new X({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:": typing.Optional[typing.Dict[str, typing.Any]] = 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.Tensor</code> of shape <code>(batch_size, image_sequence_length, in_channels)</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.Tensor</code> of shape <code>(batch_size, text_sequence_length, joint_attention_dim)</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.Tensor</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.`,name:"timestep"},{anchor:"diffusers.FluxTransformer2DModel.forward.block_controlnet_hidden_states",description:`<strong>block_controlnet_hidden_states</strong> &#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:"block_controlnet_hidden_states"},{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/main/src/diffusers/models/transformers/transformer_flux.py#L618",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>
`}}),x=new se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux_transformer.md"}}),{c(){d=i("meta"),P=r(),$=i("p"),L=r(),M(u.$$.fragment),N=r(),p=i("p"),p.innerHTML=B,z=r(),M(_.$$.fragment),E=r(),t=i("div"),M(h.$$.fragment),R=r(),b=i("p"),b.textContent=J,U=r(),T=i("p"),T.innerHTML=K,V=r(),m=i("div"),M(g.$$.fragment),W=r(),v=i("p"),v.innerHTML=Q,C=r(),M(x.$$.fragment),H=r(),D=i("p"),this.h()},l(e){const n=re("svelte-u9bgzb",document.head);d=l(n,"META",{name:!0,content:!0}),n.forEach(o),P=s(e),$=l(e,"P",{}),O($).forEach(o),L=s(e),F(u.$$.fragment,e),N=s(e),p=l(e,"P",{"data-svelte-h":!0}),q(p)!=="svelte-e6h9db"&&(p.innerHTML=B),z=s(e),F(_.$$.fragment,e),E=s(e),t=l(e,"DIV",{class:!0});var f=O(t);F(h.$$.fragment,f),R=s(f),b=l(f,"P",{"data-svelte-h":!0}),q(b)!=="svelte-19p4ty0"&&(b.textContent=J),U=s(f),T=l(f,"P",{"data-svelte-h":!0}),q(T)!=="svelte-mxgguy"&&(T.innerHTML=K),V=s(f),m=l(f,"DIV",{class:!0});var I=O(m);F(g.$$.fragment,I),W=s(I),v=l(I,"P",{"data-svelte-h":!0}),q(v)!=="svelte-4l0nim"&&(v.innerHTML=Q),I.forEach(o),f.forEach(o),C=s(e),F(x.$$.fragment,e),H=s(e),D=l(e,"P",{}),O(D).forEach(o),this.h()},h(){S(d,"name","hf:doc:metadata"),S(d,"content",de),S(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(t,"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){c(document.head,d),a(e,P,n),a(e,$,n),a(e,L,n),w(u,e,n),a(e,N,n),a(e,p,n),a(e,z,n),w(_,e,n),a(e,E,n),a(e,t,n),w(h,t,null),c(t,R),c(t,b),c(t,U),c(t,T),c(t,V),c(t,m),w(g,m,null),c(m,W),c(m,v),a(e,C,n),w(x,e,n),a(e,H,n),a(e,D,n),A=!0},p:ee,i(e){A||(y(u.$$.fragment,e),y(_.$$.fragment,e),y(h.$$.fragment,e),y(g.$$.fragment,e),y(x.$$.fragment,e),A=!0)},o(e){j(u.$$.fragment,e),j(_.$$.fragment,e),j(h.$$.fragment,e),j(g.$$.fragment,e),j(x.$$.fragment,e),A=!1},d(e){e&&(o(P),o($),o(L),o(N),o(p),o(z),o(E),o(t),o(C),o(H),o(D)),o(d),k(u,e),k(_,e),k(h),k(g),k(x,e)}}}const de='{"title":"FluxTransformer2DModel","local":"fluxtransformer2dmodel","sections":[{"title":"FluxTransformer2DModel","local":"diffusers.FluxTransformer2DModel","sections":[],"depth":2}],"depth":1}';function ie(G){return ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ue extends oe{constructor(d){super(),te(this,d,ie,ae,Z,{})}}export{ue as component};
