import{s as ne,n as te,o as oe}from"../chunks/scheduler.53228c21.js";import{S as re,i as se,e as i,s as r,c as D,h as ae,a as l,d as t,b as s,f as q,g as M,j as R,k as U,l as c,m as a,n as F,t as y,o as w,p as j}from"../chunks/index.100fac89.js";import{C as de}from"../chunks/CopyLLMTxtMenu.2cdbb51f.js";import{D as Z}from"../chunks/Docstring.d46840f1.js";import{H as ee,E as ie}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3fcbbc76.js";function le(J){let d,P,k,N,u,z,p,C,_,K='A Transformer model for image-like data from <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">Flux</a>.',E,h,H,o,g,V,T,Q="The Transformer model introduced in Flux.",W,$,X='Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a>',G,m,x,B,v,Y='The <a href="/docs/diffusers/main/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',A,b,I,L,O;return u=new de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new ee({props:{title:"FluxTransformer2DModel",local:"fluxtransformer2dmodel",headingTag:"h1"}}),h=new ee({props:{title:"FluxTransformer2DModel",local:"diffusers.FluxTransformer2DModel",headingTag:"h2"}}),g=new Z({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#L525"}}),x=new Z({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#L637",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>
`}}),b=new ie({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux_transformer.md"}}),{c(){d=i("meta"),P=r(),k=i("p"),N=r(),D(u.$$.fragment),z=r(),D(p.$$.fragment),C=r(),_=i("p"),_.innerHTML=K,E=r(),D(h.$$.fragment),H=r(),o=i("div"),D(g.$$.fragment),V=r(),T=i("p"),T.textContent=Q,W=r(),$=i("p"),$.innerHTML=X,G=r(),m=i("div"),D(x.$$.fragment),B=r(),v=i("p"),v.innerHTML=Y,A=r(),D(b.$$.fragment),I=r(),L=i("p"),this.h()},l(e){const n=ae("svelte-u9bgzb",document.head);d=l(n,"META",{name:!0,content:!0}),n.forEach(t),P=s(e),k=l(e,"P",{}),q(k).forEach(t),N=s(e),M(u.$$.fragment,e),z=s(e),M(p.$$.fragment,e),C=s(e),_=l(e,"P",{"data-svelte-h":!0}),R(_)!=="svelte-e6h9db"&&(_.innerHTML=K),E=s(e),M(h.$$.fragment,e),H=s(e),o=l(e,"DIV",{class:!0});var f=q(o);M(g.$$.fragment,f),V=s(f),T=l(f,"P",{"data-svelte-h":!0}),R(T)!=="svelte-19p4ty0"&&(T.textContent=Q),W=s(f),$=l(f,"P",{"data-svelte-h":!0}),R($)!=="svelte-mxgguy"&&($.innerHTML=X),G=s(f),m=l(f,"DIV",{class:!0});var S=q(m);M(x.$$.fragment,S),B=s(S),v=l(S,"P",{"data-svelte-h":!0}),R(v)!=="svelte-4l0nim"&&(v.innerHTML=Y),S.forEach(t),f.forEach(t),A=s(e),M(b.$$.fragment,e),I=s(e),L=l(e,"P",{}),q(L).forEach(t),this.h()},h(){U(d,"name","hf:doc:metadata"),U(d,"content",ce),U(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(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){c(document.head,d),a(e,P,n),a(e,k,n),a(e,N,n),F(u,e,n),a(e,z,n),F(p,e,n),a(e,C,n),a(e,_,n),a(e,E,n),F(h,e,n),a(e,H,n),a(e,o,n),F(g,o,null),c(o,V),c(o,T),c(o,W),c(o,$),c(o,G),c(o,m),F(x,m,null),c(m,B),c(m,v),a(e,A,n),F(b,e,n),a(e,I,n),a(e,L,n),O=!0},p:te,i(e){O||(y(u.$$.fragment,e),y(p.$$.fragment,e),y(h.$$.fragment,e),y(g.$$.fragment,e),y(x.$$.fragment,e),y(b.$$.fragment,e),O=!0)},o(e){w(u.$$.fragment,e),w(p.$$.fragment,e),w(h.$$.fragment,e),w(g.$$.fragment,e),w(x.$$.fragment,e),w(b.$$.fragment,e),O=!1},d(e){e&&(t(P),t(k),t(N),t(z),t(C),t(_),t(E),t(H),t(o),t(A),t(I),t(L)),t(d),j(u,e),j(p,e),j(h,e),j(g),j(x),j(b,e)}}}const ce='{"title":"FluxTransformer2DModel","local":"fluxtransformer2dmodel","sections":[{"title":"FluxTransformer2DModel","local":"diffusers.FluxTransformer2DModel","sections":[],"depth":2}],"depth":1}';function me(J){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends re{constructor(d){super(),se(this,d,me,le,ne,{})}}export{ge as component};
