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)
Bases: object
Serializable serve-able pipeline.
-
Parameters:
-
- model (ArtifactComponent | None)
- tokenizer (ArtifactComponent | None)
- format_spec (ArtifactComponent | None)
- engine_config (ArtifactComponent | None)
- kv_cache (ArtifactComponent | None)
- batch_processor (ArtifactComponent | None)
- weight_loader (ArtifactComponent | None)
batch_processor
batch_processor: ArtifactComponent | None = None
component_slots()
classmethod component_slots()
Returns the names of the component slots.
component_types()
classmethod component_types()
Returns the class each slot is deserialized with.
-
Returns:
-
A mapping from slot name to component class, or to
Nonefor a slot still annotated with theArtifactComponentprotocol. -
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()
Returns the set component slots, keyed by slot name.
-
Return type:
engine_config
engine_config: ArtifactComponent | None = None
format_spec
format_spec: ArtifactComponent | None = None
kv_cache
kv_cache: ArtifactComponent | None = None
model
model: ArtifactComponent | None = None
model_sources()
model_sources()
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
weight_loader
weight_loader: ArtifactComponent | None = None