Python module
max.pipelines.architectures.flux2_modulev3
FLUX.2 diffusion architecture for image generation.
Flux2ArchConfigβ
class max.pipelines.architectures.flux2_modulev3.Flux2ArchConfig(*, max_seq_len=512)
Bases: ArchConfig
Pipeline-level config for Flux2 (implements ArchConfig; no KV cache).
-
Parameters:
-
max_seq_len (int)
get_max_seq_len()β
get_max_seq_len()
Returns the maximum sequence length for the tokenizer.
-
Return type:
initialize()β
classmethod initialize(pipeline_config, model_config=None)
Initialize the config from a PipelineConfig.
-
Parameters:
-
- pipeline_config (PipelineConfig) β The pipeline configuration.
- model_config (MAXModelConfig | None) β The model configuration to read from. When
None(the default),pipeline_config.modelis used. Pass an explicit config (e.g.pipeline_config.draft_model) to initialize the arch config for a different model.
-
Return type:
max_seq_lenβ
max_seq_len: int = 512
Flux2Configβ
class max.pipelines.architectures.flux2_modulev3.Flux2Config(*, config_file=None, section_name=None, patch_size=1, in_channels=128, out_channels=None, num_layers=8, num_single_layers=48, attention_head_dim=128, num_attention_heads=48, joint_attention_dim=15360, timestep_guidance_channels=256, mlp_ratio=3.0, axes_dims_rope=(32, 32, 32, 32), rope_theta=2000, eps=1e-06, guidance_embeds=True, dtype=bfloat16, device=<factory>, quant_config=None)
Bases: MAXModelConfigBase
-
Parameters:
-
- config_file (str | None)
- section_name (str | None)
- patch_size (int)
- in_channels (int)
- out_channels (int | None)
- num_layers (int)
- num_single_layers (int)
- attention_head_dim (int)
- num_attention_heads (int)
- joint_attention_dim (int)
- timestep_guidance_channels (int)
- mlp_ratio (float)
- axes_dims_rope (tuple[int, ...])
- rope_theta (int)
- eps (float)
- guidance_embeds (bool)
- dtype (DType)
- device (DeviceRef)
- quant_config (QuantConfig | None)
attention_head_dimβ
attention_head_dim: int
axes_dims_ropeβ
deviceβ
device: DeviceRef
dtypeβ
dtype: DType
epsβ
eps: float
guidance_embedsβ
guidance_embeds: bool
If False (Klein/distilled), no guidance embedder weights are expected.
in_channelsβ
in_channels: int
initialize_from_config()β
classmethod initialize_from_config(config_dict, encoding, devices)
joint_attention_dimβ
joint_attention_dim: int
mlp_ratioβ
mlp_ratio: float
model_configβ
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'strict': False}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
num_attention_headsβ
num_attention_heads: int
num_layersβ
num_layers: int
num_single_layersβ
num_single_layers: int
out_channelsβ
patch_sizeβ
patch_size: int
quant_configβ
quant_config: QuantConfig | None
NVFP4 quantization config, populated when encoding is float4_e2m1fnx2.
rope_thetaβ
rope_theta: int
timestep_guidance_channelsβ
timestep_guidance_channels: int
Flux2TransformerModelβ
class max.pipelines.architectures.flux2_modulev3.Flux2TransformerModel(config, encoding, devices, weights, *, cache_config=None)
Bases: ComponentModel
-
Parameters:
load_model()β
load_model()
Load and return a runtime model instance.
-
Return type:
-
None
modelβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!