IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python module

max.pipelines.architectures.ideogram4

Ideogram 4 flow-matching text-to-image architecture.

Ideogram4ArchConfig

class max.pipelines.architectures.ideogram4.Ideogram4ArchConfig(*, pipeline_config: 'PipelineConfig', quantization_encoding: 'SupportedEncoding | None' = None)

source

Bases: ArchConfig

Parameters:

DEFAULT_ENCODING

DEFAULT_ENCODING: ClassVar[SupportedEncoding] = 'bfloat16'

source

SUPPORTED_ENCODINGS

SUPPORTED_ENCODINGS: ClassVar[set[SupportedEncoding]] = {'bfloat16'}

source

calculate_max_seq_len()

classmethod calculate_max_seq_len(huggingface_config, model_config)

source

Returns the resolved maximum sequence length.

Bounds or defaults the user’s model_config.max_length with the model’s own limits. Construction runs this once and stores the result on model_config.max_length; memory planning may lower it further, but only on the memory plan.

Parameters:

  • huggingface_config (AutoConfig) – The HuggingFace config to read model bounds from.
  • model_config (MAXModelConfig) – The model config whose max_length carries the user’s setting.

Return type:

int

get_max_seq_len()

get_max_seq_len()

source

Returns the effective maximum sequence length for the model.

For configs that store a deployment length, this is the value initialize received; for metadata-only configs it derives from the checkpoint.

Return type:

int

initialize()

classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)

source

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.model is used. Pass an explicit config (e.g. pipeline_config.draft_model) to initialize the arch config for a different model.
  • max_seq_len (int) – The effective maximum sequence length to store on the config. The value is received, never derived here: the pipeline model passes the memory plan’s VRAM-clamped length, while memory planning (which runs before a plan exists) passes the construction-resolved model_config.max_length. Configs whose sequence length is pure model metadata (e.g. diffusion components) ignore it.

Return type:

Self

pipeline_config

pipeline_config: PipelineConfig

source

quantization_encoding

quantization_encoding: SupportedEncoding | None = None

source

Ideogram4Config

class max.pipelines.architectures.ideogram4.Ideogram4Config(*, config_file=None, section_name=None, emb_dim=4608, num_layers=34, num_heads=18, intermediate_size=12288, adaln_dim=512, norm_eps=1e-05, in_channels=128, llm_features_dim=53248, rope_theta=5000000.0, mrope_section=(24, 20, 20), dtype=bfloat16, device=<factory>)

source

Bases: MAXModelConfigBase

Architecture parameters for Ideogram4Transformer2DModel.

Defaults mirror ideogram-ai/ideogram-4-fp8 transformer/config.json and the reference ideogram4.modeling_ideogram4.Ideogram4Config.

Parameters:

adaln_dim

adaln_dim: int

source

device

device: DeviceRef

source

dtype

dtype: DType

source

emb_dim

emb_dim: int

source

head_dim

property head_dim: int

source

in_channels

in_channels: int

source

initialize_from_config()

classmethod initialize_from_config(config_dict, encoding, devices)

source

Parameters:

  • config_dict (dict[str, Any])
  • encoding (Literal['float32', 'float16', 'bfloat16', 'q4_k', 'q4_0', 'q6_k', 'float8_e4m3fn', 'float4_e2m1fnx2', 'float6_e2m3fn', 'gptq'])
  • devices (list[Device])

Return type:

Self

intermediate_size

intermediate_size: int

source

llm_features_dim

llm_features_dim: int

source

model_config

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'strict': False}

source

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

mrope_section

mrope_section: tuple[int, ...]

source

norm_eps

norm_eps: float

source

num_heads

num_heads: int

source

num_layers

num_layers: int

source

rope_theta

rope_theta: float

source

Ideogram4Transformer2DModel

class max.pipelines.architectures.ideogram4.Ideogram4Transformer2DModel(config)

source

Bases: Module

Ideogram 4 flow-matching transformer producing velocity predictions.

Parameters:

config (Ideogram4Config)

forward()

forward(*args)

source

Defines the computation performed by the module.

Users must override this method in their subclass to define the module’s computation.

Parameters:

  • *args (Tensor) – Positional arguments for the computation.
  • **kwargs – Keyword arguments for the computation.

Returns:

The result of applying the module to the input.

Raises:

NotImplementedError – If the subclass does not override this method.

Return type:

tuple[Tensor, …]

input_types()

input_types()

source

Return type:

tuple[TensorType, …]

Ideogram4TransformerModel

class max.pipelines.architectures.ideogram4.Ideogram4TransformerModel(config, encoding, devices, weights)

source

Bases: ComponentModel

Loads + adapts one Ideogram 4 DiT checkpoint (cond or uncond branch).

Parameters:

load_model()

load_model()

source

Adapt the checkpoint into a bf16 state dict (no standalone compile).

The actual graph compilation happens once in the pipeline, where both branches are fused into a single denoise-step graph.

Return type:

None