import{s as te,n as ne,o as oe}from"../chunks/scheduler.53228c21.js";import{S as re,i as se,e as d,s as r,c as D,h as ae,a as l,d as n,b as s,f as S,g as M,j as U,k as R,l as c,m as a,n as y,t as F,o as w,p as k}from"../chunks/index.100fac89.js";import{C as ie}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as Z}from"../chunks/Docstring.46d0934e.js";import{H as ee,E as de}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function le(B){let i,P,j,C,u,z,p,E,_,J='A Transformer model for image-like data from <a href="https://hf.co/black-forest-labs/FLUX.2-dev" rel="nofollow">Flux2</a>.',H,h,N,o,g,V,b,K="The Transformer model introduced in Flux 2.",W,$,Q='Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a>',G,m,x,X,v,Y='The <a href="/docs/diffusers/main/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',A,T,I,L,O;return u=new ie({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new ee({props:{title:"Flux2Transformer2DModel",local:"flux2transformer2dmodel",headingTag:"h1"}}),h=new ee({props:{title:"Flux2Transformer2DModel",local:"diffusers.Flux2Transformer2DModel",headingTag:"h2"}}),g=new Z({props:{name:"class diffusers.Flux2Transformer2DModel",anchor:"diffusers.Flux2Transformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 128"},{name:"out_channels",val:": typing.Optional[int] = None"},{name:"num_layers",val:": int = 8"},{name:"num_single_layers",val:": int = 48"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 48"},{name:"joint_attention_dim",val:": int = 15360"},{name:"timestep_guidance_channels",val:": int = 256"},{name:"mlp_ratio",val:": float = 3.0"},{name:"axes_dims_rope",val:": typing.Tuple[int, ...] = (32, 32, 32, 32)"},{name:"rope_theta",val:": int = 2000"},{name:"eps",val:": float = 1e-06"}],parametersDescription:[{anchor:"diffusers.Flux2Transformer2DModel.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.Flux2Transformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.Flux2Transformer2DModel.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.Flux2Transformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>8</code>) &#x2014;
The number of layers of dual stream DiT blocks to use.`,name:"num_layers"},{anchor:"diffusers.Flux2Transformer2DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of layers of single stream DiT blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.Flux2Transformer2DModel.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.Flux2Transformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of attention heads to use.`,name:"num_attention_heads"},{anchor:"diffusers.Flux2Transformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>15360</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.Flux2Transformer2DModel.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.Flux2Transformer2DModel.guidance_embeds",description:`<strong>guidance_embeds</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to use guidance embeddings for guidance-distilled variant of the model.`,name:"guidance_embeds"},{anchor:"diffusers.Flux2Transformer2DModel.axes_dims_rope",description:`<strong>axes_dims_rope</strong> (<code>Tuple[int]</code>, defaults to <code>(32, 32, 32, 32)</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_flux2.py#L631"}}),x=new Z({props:{name:"forward",anchor:"diffusers.Flux2Transformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",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:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.Flux2Transformer2DModel.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.Flux2Transformer2DModel.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.Flux2Transformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.Flux2Transformer2DModel.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.Flux2Transformer2DModel.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.Flux2Transformer2DModel.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_flux2.py#L763",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>
`}}),T=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux2_transformer.md"}}),{c(){i=d("meta"),P=r(),j=d("p"),C=r(),D(u.$$.fragment),z=r(),D(p.$$.fragment),E=r(),_=d("p"),_.innerHTML=J,H=r(),D(h.$$.fragment),N=r(),o=d("div"),D(g.$$.fragment),V=r(),b=d("p"),b.textContent=K,W=r(),$=d("p"),$.innerHTML=Q,G=r(),m=d("div"),D(x.$$.fragment),X=r(),v=d("p"),v.innerHTML=Y,A=r(),D(T.$$.fragment),I=r(),L=d("p"),this.h()},l(e){const t=ae("svelte-u9bgzb",document.head);i=l(t,"META",{name:!0,content:!0}),t.forEach(n),P=s(e),j=l(e,"P",{}),S(j).forEach(n),C=s(e),M(u.$$.fragment,e),z=s(e),M(p.$$.fragment,e),E=s(e),_=l(e,"P",{"data-svelte-h":!0}),U(_)!=="svelte-89orn1"&&(_.innerHTML=J),H=s(e),M(h.$$.fragment,e),N=s(e),o=l(e,"DIV",{class:!0});var f=S(o);M(g.$$.fragment,f),V=s(f),b=l(f,"P",{"data-svelte-h":!0}),U(b)!=="svelte-1qdlpc6"&&(b.textContent=K),W=s(f),$=l(f,"P",{"data-svelte-h":!0}),U($)!=="svelte-mxgguy"&&($.innerHTML=Q),G=s(f),m=l(f,"DIV",{class:!0});var q=S(m);M(x.$$.fragment,q),X=s(q),v=l(q,"P",{"data-svelte-h":!0}),U(v)!=="svelte-4l0nim"&&(v.innerHTML=Y),q.forEach(n),f.forEach(n),A=s(e),M(T.$$.fragment,e),I=s(e),L=l(e,"P",{}),S(L).forEach(n),this.h()},h(){R(i,"name","hf:doc:metadata"),R(i,"content",ce),R(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(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,t){c(document.head,i),a(e,P,t),a(e,j,t),a(e,C,t),y(u,e,t),a(e,z,t),y(p,e,t),a(e,E,t),a(e,_,t),a(e,H,t),y(h,e,t),a(e,N,t),a(e,o,t),y(g,o,null),c(o,V),c(o,b),c(o,W),c(o,$),c(o,G),c(o,m),y(x,m,null),c(m,X),c(m,v),a(e,A,t),y(T,e,t),a(e,I,t),a(e,L,t),O=!0},p:ne,i(e){O||(F(u.$$.fragment,e),F(p.$$.fragment,e),F(h.$$.fragment,e),F(g.$$.fragment,e),F(x.$$.fragment,e),F(T.$$.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(T.$$.fragment,e),O=!1},d(e){e&&(n(P),n(j),n(C),n(z),n(E),n(_),n(H),n(N),n(o),n(A),n(I),n(L)),n(i),k(u,e),k(p,e),k(h,e),k(g),k(x),k(T,e)}}}const ce='{"title":"Flux2Transformer2DModel","local":"flux2transformer2dmodel","sections":[{"title":"Flux2Transformer2DModel","local":"diffusers.Flux2Transformer2DModel","sections":[],"depth":2}],"depth":1}';function me(B){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends re{constructor(i){super(),se(this,i,me,le,te,{})}}export{ge as component};
