IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/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')

source

Bases: ArchConfig

Parameters:

pipeline_config (PipelineConfig)

get_max_seq_len()​

get_max_seq_len()

source

Returns the default maximum sequence length for the model.

Subclasses should determine whether this value can be overridden by setting the --max-length (pipeline_config.model.max_length) flag.

Return type:

int

initialize()​

classmethod initialize(pipeline_config, model_config=None)

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.

Return type:

Self

pipeline_config​

pipeline_config: PipelineConfig

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', 'bfloat16', 'q4_k', 'q4_0', 'q6_k', 'float8_e4m3fn', 'float4_e2m1fnx2', '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