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 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:
loader()
loader()
Returns a WeightLoader over the role-prefixed union.
Public entry point for multi-component pipelines (diffusion,
speculative decoding). Each role’s loader is exposed under its
dotted role prefix, so a query like
"transformer.blocks.0.attn.qkv_proj.weight" routes to the
transformer config’s loader with "blocks.0.attn.qkv_proj.weight".
Single-model pipelines should call manifest["main"].loader()
instead – the role prefix is not useful when there’s only one
source and the Module tree’s parameter names don’t carry it.
Resolution is lazy: per-role loaders defer to the underlying
Weights source, so weight bytes only
page in when the Module’s adapter chain actually queries them.
-
Returns:
-
A
WeightLoaderresolvingf"{role}.{name}"keys against the per-role source loaders. -
Return type:
-
WeightLoader
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!