Python class
ModelManifest
ModelManifestβ
class max.pipelines.lib.ModelManifest(*args, metadata=None, **kwargs)
Bases: dict[str, MAXModelConfig]
Registry mapping semantic role strings to MAXModelConfig instances.
Each model is identified by a role string (e.g. "main",
"draft", "vae", "unet"). Single-model pipelines use the
"main" key by convention; multi-component pipelines (diffusion,
speculative decoding) store models under their respective roles.
ModelManifest is a dict[str, MAXModelConfig] subclass, so
standard dict operations ([], in, len, items, etc.)
work directly.
For diffusion pipelines constructed from model_index.json, the
metadata property exposes non-component entries (e.g.
_class_name, _diffusers_version, is_distilled) as a
plain dict.
clear()β
clear()
Remove all model configs from the manifest.
-
Return type:
-
None
from_model_path()β
classmethod from_model_path(model_path, revision=None, **kwargs)
Create a registry from a single model path.
Inspects model_path for a model_index.json before
constructing any MAXModelConfig.
If the model is a diffusion pipeline (has a model_index.json),
the registry is automatically expanded into per-component
MAXModelConfig instances. Extra kwargs are forwarded to
each componentβs MAXModelConfig.
For single-model repos, a MAXModelConfig is constructed from model_path and any extra kwargs, then stored under the
"main" key.
-
Parameters:
-
- model_path (str) β HuggingFace repo ID or local path to the model.
- revision (str | None) β Optional HuggingFace repo revision (branch, tag, or commit hash). Defaults to the HuggingFace Hub default.
- **kwargs (Any) β Additional keyword arguments forwarded to
MAXModelConfig(only valid for single-model repos).
-
Returns:
-
A new
ModelManifest. For transformers-style models this has a single"main"entry; for diffusion models it contains one entry per component. -
Return type:
log_model_info()β
log_model_info()
Logs model configuration information for every model in the manifest.
Iterates over each role and delegates to
MAXModelConfig.log_model_info() for per-model details.
-
Return type:
-
None
main_architecture_nameβ
property main_architecture_name: str
Returns the main architecture class name.
For non-diffusion models (those with a "main" key),
delegates to MAXModelConfig.architecture_name which returns
architectures[0] from the HuggingFace config.
For diffusion pipelines (no "main" key), returns
metadata["_class_name"] (e.g. "FluxPipeline").
-
Raises:
-
ValueError β If the architecture name cannot be determined.
metadataβ
Non-component entries from model_index.json.
For diffusion pipelines built via from_model_path, this
contains every key/value pair from model_index.json that is
not a component (e.g. _class_name, _diffusers_version,
is_distilled). For non-diffusion manifests, returns an
empty dict.
model_nameβ
property model_name: str
Returns the served model name for metrics and API responses.
For single-model pipelines ("main" key), delegates to
MAXModelConfig.model_name. For diffusion pipelines,
returns model_path from the first component config.
pop()β
pop(*args)
Remove and return a model config by key.
resolve()β
resolve()
Validates and resolves every config in the manifest.
Delegates to MAXModelConfig.resolve() for each component.
-
Return type:
-
None
total_weights_sizeβ
property total_weights_size: int
Total weight size in bytes across all components.
Walks every MAXModelConfig in the manifest and sums
weights_size(). Components with no weight files (e.g.
schedulers) contribute zero.
-
Raises:
-
RuntimeError β If the manifest has not been resolved via
resolve()first.
update()β
update(*args, **kwargs)
Update the manifest with new model configs.
with_override()β
with_override(role, config=None, **field_overrides)
Return a new manifest with the given role updated.
Three usage patterns:
- Partial field update on an existing component:
manifest.with_override("transformer", weight_path=[Path("w.safetensors")], quantization_encoding="float4_e2m1fnx2", ) - Full replacement or addition of a component:
manifest.with_override("draft", config=MAXModelConfig(model_path="org/draft"), ) - Add/replace with additional field tweaks:
manifest.with_override("draft", config=base_cfg, quantization_encoding="q4_0", )
-
Parameters:
-
- role (str) β The semantic role string identifying the component.
- config (MAXModelConfig | None) β A complete
MAXModelConfigto use as the base. WhenNone, the existing config for role is used (the role must already exist). - **field_overrides (Any) β Individual field values to set on the
config via
model_copy(update=...).
-
Returns:
-
A new
ModelManifestβ the original is not modified. -
Raises:
-
ValueError β If config is
Noneand role does not exist, or if neither config nor field_overrides are provided. -
Return type:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!