flux2_double_block

FLUX.2 double-stream (MMDiT) block

Description

Image and text streams with externally supplied (shift, scale, gate) modulation triples, joint attention (txt first), and SwiGLU feed-forwards. Reference: Flux2TransformerBlock.

Usage

flux2_double_block(dim, num_attention_heads, attention_head_dim, mlp_ratio = 3,
                   eps = 1e-06, bias = FALSE)

Arguments

  • dim: Integer. Model dimension.
  • num_attention_heads: Integer. Attention heads.
  • attention_head_dim: Integer. Per-head dimension.
  • mlp_ratio: Numeric. FF multiplier (FLUX.2: 3.0).
  • eps: Numeric. Norm epsilon.
  • bias: Logical.

Value

Module whose forward(hidden_states, encoder_hidden_states, temb_mod_img, temb_mod_txt, image_rotary_emb) returns list(encoder_hidden_states, hidden_states).