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 function

serialize

serialize()​

max.pipelines.lib.artifact.serialize(model_artifact, path)

source

Serializes a model artifact to a .m directory.

The directory is written to a temporary sibling and renamed into place, so a failed export never leaves a partial artifact behind.

Parameters:

  • model_artifact (ModelArtifact) – The artifact to serialize.
  • path (str | PathLike[str]) – The destination. .m is appended unless it already ends in .m.

Returns:

The path of the written artifact directory.

Raises:

ArtifactError – If the destination exists or a component’s serialized form is invalid.

Return type:

Path