Model Registry#
Retrieval#
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 toNone
.
Returns
ModelRegistry
. A model registry handle object to perform operations on.
Modules#
project_path#
Path of the project the registry is connected to.
python#
Module for exporting a generic Python model.
sklearn#
Module for exporting a sklearn model.
tensorflow#
Module for exporting a TensorFlow model.
torch#
Module for exporting a torch model.
Properties#
model_registry_id#
Id of the model registry.
project_id#
Id of the project the registry is connected to.
project_name#
Name of the project the registry is connected to.
project_path#
Path of the project the registry is connected to.
shared_registry_project_name#
Name of the project the shared model registry originates from.
Methods#
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.
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 toNone
and will return theversion=1
.
Returns
Model
: The model metadata object.
Raises
RestAPIError
: If unable to retrieve model from the model registry.
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.