mlops.artifact package
Submodules
mlops.artifact.versioned_artifact module
Contains the VersionedArtifact class.
- class mlops.artifact.versioned_artifact.VersionedArtifact
Bases:
abc.ABC
Represents a versioned artifact (e.g., a dataset or model).
- abstract property md5: str
Returns the artifact’s MD5 hash.
- Returns
The artifact’s MD5 hash.
- abstract property metadata_path: str
Returns the local or remote path to the artifact’s metadata.
- Returns
The local or remote path to the artifact’s metadata.
- abstract property name: str
Returns the artifact’s name.
- Returns
The artifact’s name.
- abstract property path: str
Returns the local or remote path to the artifact.
- Returns
The local or remote path to the artifact.
- republish(republication_path: str) str
Saves the versioned artifact files to the given path. If the path and appended version already exists, this operation will raise a PublicationPathAlreadyExistsError.
- Parameters
republication_path – The path, either on the local filesystem or in a cloud store such as S3, to which the artifact should be saved. The version will be appended to this path as a subdirectory. An S3 path should be a URL of the form “s3://bucket-name/path/to/dir”. It is recommended to use this same path to publish all artifacts, since it will prevent the user from creating two different artifacts with the same version.
- Returns
The versioned artifact’s publication path.
- update_metadata(updates: dict[str, Any]) None
Updates the artifact’s metadata with the new values.
The current object will not reflect changes made to the metadata and will need to be reloaded from the path. For example, updating the object’s name in the metadata will not change the object’s name field, but will change the name of any future copies of the object loaded from the same versioned files.
- Parameters
updates – The dictionary of keys and values to add or update. If a key does not exist in the metadata, it is added; if it does exist, its value is overwritten.
- abstract property version: str
Returns the artifact’s version.
- Returns
The artifact’s version.
mlops.artifact.versioned_artifact_builder module
Contains the VersionedArtifactBuilder class.
- class mlops.artifact.versioned_artifact_builder.VersionedArtifactBuilder
Bases:
abc.ABC
Represents a versioned artifact builder.
- abstract publish(path: str, *args: Any, **kwargs: Any) str
Saves the versioned artifact files to the given path. If the path and appended version already exists, this operation will raise a PublicationPathAlreadyExistsError.
- Parameters
path – The path, either on the local filesystem or in a cloud store such as S3, to which the artifact should be saved. The version will be appended to this path as a subdirectory. An S3 path should be a URL of the form “s3://bucket-name/path/to/dir”. It is recommended to use this same path to publish all artifacts of a given type (e.g., datasets, models), since it will prevent the user from creating two different artifacts with the same version.
args – Additional positional args.
kwargs – Keyword args.
- Returns
The versioned artifact’s publication path.
Module contents
Contains versioned artifact modules.