Skip to content

Model Registry#

Retrieval#

[source]

get_model_registry#

Connection.get_model_registry(project=None)

Get a reference to a model registry to perform operations on, defaulting to the project's default model registry. Shared model registries can be retrieved by passing the project argument.

Arguments

  • project str: The name of the project that owns the shared model registry, the model registry must be shared with the project the connection was established for, defaults to None.

Returns

ModelRegistry. A model registry handle object to perform operations on.


Modules#

[source]

project_path#

Path of the project the registry is connected to.


[source]

python#

Module for exporting a generic Python model.


[source]

sklearn#

Module for exporting a sklearn model.


[source]

tensorflow#

Module for exporting a TensorFlow model.


[source]

torch#

Module for exporting a torch model.


Properties#

[source]

model_registry_id#

Id of the model registry.


[source]

project_id#

Id of the project the registry is connected to.


[source]

project_name#

Name of the project the registry is connected to.


[source]

project_path#

Path of the project the registry is connected to.


[source]

shared_registry_project_name#

Name of the project the shared model registry originates from.


Methods#

[source]

get_best_model#

ModelRegistry.get_best_model(name, metric, direction)

Get the best performing model entity from the model registry. Getting the best performing model from the Model Registry means specifying in addition to the name, also a metric name corresponding to one of the keys in the training_metrics dict of the model and a direction. For example to get the model version with the highest accuracy, specify metric='accuracy' and direction='max'.

Arguments

  • name str: Name of the model to get.
  • metric str: Name of the key in the training metrics field to compare.
  • direction str: 'max' to get the model entity with the highest value of the set metric, or 'min' for the lowest.

Returns

Model: The model metadata object.

Raises

  • RestAPIError: If unable to retrieve model from the model registry.

[source]

get_model#

ModelRegistry.get_model(name, version=None)

Get a model entity from the model registry. Getting a model from the Model Registry means getting its metadata handle so you can subsequently download the model directory.

Arguments

  • name str: Name of the model to get.
  • version Optional[int]: Version of the model to retrieve, defaults to None and will return the version=1.

Returns

Model: The model metadata object.

Raises

  • RestAPIError: If unable to retrieve model from the model registry.

[source]

get_models#

ModelRegistry.get_models(name)

Get all model entities from the model registry for a specified name. Getting all models from the Model Registry for a given name returns a list of model entities, one for each version registered under the specified model name.

Arguments

  • name str: Name of the model to get.

Returns

List[Model]: A list of model metadata objects.

Raises

  • RestAPIError: If unable to retrieve model versions from the model registry.