Skip to content

Model

Model is an API object implementing various methods to manipulate models in the model registry.

Model.init

__init__(workspace: str, model_name: str, *, api_key=None)

Model.add_tag

add_tag(version: str, tag: str)

add a tag to a given version of the model

Args:

  • version: the model version
  • tag: the tag to add

Model.delete_tag

delete_tag(version: str, tag: str)

delete a tag from a given version of the model

Args:

  • version: the model version
  • tag: the tag to delete

Model.download

download(version: str, output_folder: Union[pathlib.Path, str],
    expand: bool = True) -> None

download the files for a given version of the model.

Args:

  • version: the model version
  • output_folder: files will be saved in this folder
  • expand: if True (the default), model files will be saved to the given folder. If False, a zip file named "{model_name}_{version}.zip" will be saved there instead.

Model.find_versions

find_versions(version_prefix="", status=None, tag=None)

return a list of versions for the model, sorted in descending order (latest version is first).

Args:

  • version_prefix: optional. If specified, return only those versions that start with version_prefix, e.g. "3" may find "3.2" but not "4.0", and "2.1" will find "2.1.0" and "2.1.1" but not "2.0.0" or "2.2.3".
  • status: optional. If specified, return only versions with the given status.
  • tag: optional. If specified, return only versions with the given tag.

Model.get_details

get_details(version: str)

returns a dict with various details about the given model version.

The exact details returned may vary by backend version, but they include e.g. experimentKey, comment, createdAt timestamp, updatedAt timestamp.

Args:

  • version: the model version

Model.name

name()

Model.set_status

set_status(version, status)

set the status of a given version of the model

Args:

  • version: the model version
  • status: one of the allowed status values, e.g. "Production"

see also: the model_registry_allowed_status_values() on the API class.

Model.status

status(version: str)

returns the status for a given version of the model, e.g. "Production"

Args:

  • version: the model version

Model.tags

tags(version: str)

returns the tags for a given version of the model.

Args:

  • version: the model version
May. 24, 2023