Buckets:

hf-doc-build/doc-dev / diffusers /pr_13881 /en /api /models /flux_transformer.md
HuggingFaceDocBuilder's picture
|
download
raw
3.8 kB

FluxTransformer2DModel

A Transformer model for image-like data from Flux.

FluxTransformer2DModel[[diffusers.FluxTransformer2DModel]]

  • patch_size (int, defaults to 1) -- Patch size to turn the input data into small patches.
  • in_channels (int, defaults to 64) -- The number of channels in the input.
  • out_channels (int, optional, defaults to None) -- The number of channels in the output. If not specified, it defaults to in_channels.
  • num_layers (int, defaults to 19) -- The number of layers of dual stream DiT blocks to use.
  • num_single_layers (int, defaults to 38) -- The number of layers of single stream DiT blocks to use.
  • attention_head_dim (int, defaults to 128) -- The number of dimensions to use for each attention head.
  • num_attention_heads (int, defaults to 24) -- The number of attention heads to use.
  • joint_attention_dim (int, defaults to 4096) -- The number of dimensions to use for the joint attention (embedding/channel dimension of encoder_hidden_states).
  • pooled_projection_dim (int, defaults to 768) -- The number of dimensions to use for the pooled projection.
  • guidance_embeds (bool, defaults to False) -- Whether to use guidance embeddings for guidance-distilled variant of the model.
  • axes_dims_rope (tuple[int], defaults to (16, 56, 56)) -- The dimensions to use for the rotary positional embeddings.

The Transformer model introduced in Flux.

Reference: https://blackforestlabs.ai/announcing-black-forest-labs/

  • hidden_states (torch.Tensor of shape (batch_size, image_sequence_length, in_channels)) -- Input hidden_states.
  • encoder_hidden_states (torch.Tensor of shape (batch_size, text_sequence_length, joint_attention_dim)) -- Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.
  • pooled_projections (torch.Tensor of shape (batch_size, projection_dim)) -- Embeddings projected from the embeddings of input conditions.
  • timestep ( torch.LongTensor) -- Used to indicate denoising step.
  • img_ids (torch.Tensor) -- Image position ids used to compute the rotary positional embeddings.
  • txt_ids (torch.Tensor) -- Text position ids used to compute the rotary positional embeddings.
  • guidance (torch.Tensor, optional) -- Guidance scale embedding used for guidance-distilled variants of the model.
  • controlnet_block_samples (list of torch.Tensor, optional) -- A list of tensors that if specified are added to the residuals of transformer blocks.
  • controlnet_single_block_samples (list of torch.Tensor, optional) -- A list of tensors that if specified are added to the residuals of single transformer blocks.
  • controlnet_blocks_repeat (bool, optional, defaults to False) -- Whether to repeat the controlnet block samples across all transformer blocks.
  • joint_attention_kwargs (dict, optional) -- A kwargs dictionary that if specified is passed along to the AttentionProcessor as defined under self.processor in diffusers.models.attention_processor.
  • return_dict (bool, optional, defaults to True) -- Whether or not to return a ~models.transformer_2d.Transformer2DModelOutput instead of a plain tuple.If return_dict is True, an ~models.transformer_2d.Transformer2DModelOutput is returned, otherwise a tuple where the first element is the sample tensor.

The FluxTransformer2DModel forward method.

Xet Storage Details

Size:
3.8 kB
·
Xet hash:
26df6109609fdaf4300fa2cfa384d2ce710e48554715a1fc592576500bcbcc70

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