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 class

ModelArtifact

ModelArtifact​

class max.pipelines.lib.artifact.ModelArtifact(model=None, tokenizer=None, format_spec=None, engine_config=None, kv_cache=None, batch_processor=None, weight_loader=None)

source

Bases: object

Serializable serve-able pipeline.

Parameters:

batch_processor​

batch_processor: ArtifactComponent | None = None

source

component_slots()​

classmethod component_slots()

source

Returns the names of the component slots.

Return type:

tuple[str, …]

component_types()​

classmethod component_types()

source

Returns the class each slot is deserialized with.

Returns:

A mapping from slot name to component class, or to None for a slot still annotated with the ArtifactComponent protocol.

Raises:

ArtifactError – If a slot’s annotation names more than one class or a class that isn’t an ArtifactComponent.

Return type:

dict[str, type[ArtifactComponent] | None]

components()​

components()

source

Returns the set component slots, keyed by slot name.

Return type:

dict[str, ArtifactComponent]

engine_config​

engine_config: ArtifactComponent | None = None

source

format_spec​

format_spec: ArtifactComponent | None = None

source

kv_cache​

kv_cache: ArtifactComponent | None = None

source

model​

model: ArtifactComponent | None = None

source

model_sources()​

model_sources()

source

Returns the unique Hugging Face references in the components.

Serializes every component, so prefer reading ArtifactMetadata.model_sources from an exported artifact.

Return type:

tuple[HuggingFaceRef, …]

tokenizer​

tokenizer: ArtifactComponent | None = None

source

weight_loader​

weight_loader: ArtifactComponent | None = None

source