Buckets:

download
raw
10.3 kB
import"../chunks/DsnmJJEf.js";import{i as v,h as D,C as F,H as l,D as m,E as M,s as k}from"../chunks/BtE7mKSK.js";import{p as w,o as y,s as e,f as j,a as f,b as N,c as u,d as h,n as p,r as _}from"../chunks/jDjavuwI.js";const z='{"title":"FluxTransformer2DModel","local":"fluxtransformer2dmodel","sections":[{"title":"FluxTransformer2DModel","local":"diffusers.FluxTransformer2DModel","sections":[],"depth":2}],"depth":1}';var L=h('<meta name="hf:doc:metadata"/>'),A=h('<p></p> <!> <!> <p>A Transformer model for image-like data from <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">Flux</a>.</p> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The Transformer model introduced in Flux.</p> <p>Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a></p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/diffusers/pr_14246/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.</p></div></div> <!> <p></p>',1);function E(g,b){w(b,!1),y(()=>{new URLSearchParams(window.location.search).get("fw")}),v();var n=A();D("18vukns",i=>{var c=L();k(c,"content",z),f(i,c)});var r=e(j(n),2);F(r,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var s=e(r,2);l(s,{title:"FluxTransformer2DModel",local:"fluxtransformer2dmodel",headingTag:"h1"});var t=e(s,4);l(t,{title:"FluxTransformer2DModel",local:"diffusers.FluxTransformer2DModel",headingTag:"h2"});var o=e(t,2),a=u(o);m(a,{name:"class diffusers.FluxTransformer2DModel",anchor:"diffusers.FluxTransformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/transformers/transformer_flux.py#L523",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": int | None = 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:": tuple = (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"}]});var d=e(a,6),x=u(d);m(x,{name:"forward",anchor:"diffusers.FluxTransformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14246/src/diffusers/models/transformers/transformer_flux.py#L635",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:": dict[str, typing.Any] | None = 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.img_ids",description:`<strong>img_ids</strong> (<code>torch.Tensor</code>) &#x2014;
Image position ids used to compute the rotary positional embeddings.`,name:"img_ids"},{anchor:"diffusers.FluxTransformer2DModel.forward.txt_ids",description:`<strong>txt_ids</strong> (<code>torch.Tensor</code>) &#x2014;
Text position ids used to compute the rotary positional embeddings.`,name:"txt_ids"},{anchor:"diffusers.FluxTransformer2DModel.forward.guidance",description:`<strong>guidance</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Guidance scale embedding used for guidance-distilled variants of the model.`,name:"guidance"},{anchor:"diffusers.FluxTransformer2DModel.forward.controlnet_block_samples",description:`<strong>controlnet_block_samples</strong> (<code>list</code> of <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"controlnet_block_samples"},{anchor:"diffusers.FluxTransformer2DModel.forward.controlnet_single_block_samples",description:`<strong>controlnet_single_block_samples</strong> (<code>list</code> of <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
A list of tensors that if specified are added to the residuals of single transformer blocks.`,name:"controlnet_single_block_samples"},{anchor:"diffusers.FluxTransformer2DModel.forward.controlnet_blocks_repeat",description:`<strong>controlnet_blocks_repeat</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to repeat the controlnet block samples across all transformer blocks.`,name:"controlnet_blocks_repeat"},{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"}],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>
`}),p(2),_(d),_(o);var T=e(o,2);M(T,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux_transformer.md"}),p(2),f(g,n),N()}export{E as component};

Xet Storage Details

Size:
10.3 kB
·
Xet hash:
3d48ee5f8f71d35fd5de31a303010760750b1106dbbf62fe097e4a9b951b64f8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.