Manage Models

How to manage models and model versions in your Wallaroo Ops environment.

Table of Contents

View Models via the Wallaroo Dashboard

How to View Uploaded Models

Models uploaded to the current workspace can be seen through the following process:

  1. From the Wallaroo Dashboard, select the workspace to set as the current workspace from the navigation panel above. The number of models for the workspace will be displayed.
  2. Select View Models. A list of the models in the workspace will be displayed.
  3. To view details on the model, select the model name from the list.

Model Details

From the Model Details page the following is displayed.

Wallaroo Dashboard Models page
  • (A) The name of the model.
  • (B) The unique ID of the model represented as a UUID.
  • (C) The file name and SHA hash the ML Model file of the current model version.
  • (D) Any tags assigned to the model.
  • (E) The version history of the model: Models uploaded to a workspace with the same name are assigned a a new model version.
    • (F) The unique ID of the model version represented as a UUID and creation date - the date the model was uploaded to the Wallaroo Ops.
    • (G) The filename for this model version and SHA hash of the ML Model file for this model version.
  • Associated pipelines: Pipelines where a version of this model is added as a model step.
    • (H) The model version assigned as a pipeline step.
    • (I) The pipeline version the model version is assigned to.

View Models via the Wallaroo SDK

Get Model

The method wallaroo.client.get_model retrieves the most recent model version in the current workspace that matches the provided model name unless a specific version is requested.

For more details on workspaces, see How to Set the Current Workspace.

Get Model Parameters

wallaroo.client.get_model takes the following parameters.

ParameterTypeDescription
nameString (Required)The name of the model to reference in the current workspace.
versionString (Optional) (Default: None)Returns the model version matching the version parameter. By default, returns the most recent model version for the model.

Get Model Returns

wallaroo.client.get_model returns the wallaroo.model_version.ModelVersion that matches the parameters. If no model version exists, an error is returned.

Get Model Examples

Get Model Default Example

The following demonstrates retrieving the most recent model version of the requested model.

model_name="helper-demo-model-1"
model_version = wl.get_model(name=model_name)
display(model_version)
Namehelper-demo-model-1
Version522e5e85-74f5-44d3-a734-4dfe2f70d790
File Namerf_model.onnx
SHAe22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6
Statusready
Image PathNone
Architecturex86
Accelerationnone
Updated At2024-04-Apr 18:03:38
Get Model Specific Version Example

The following demonstrates retrieving a specific model version of the requested model.

model_name="helper-demo-model-1"
model_version = wl.get_model(name=model_name, version="522e5e85-74f5-44d3-a734-4dfe2f70d790")
display(model_version)
Namehelper-demo-model-1
Version522e5e85-74f5-44d3-a734-4dfe2f70d790
File Namerf_model.onnx
SHAe22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6
Statusready
Image PathNone
Architecturex86
Accelerationnone
Updated At2024-04-Apr 18:03:38
Get Model No Matching Model Name Error Example

The following demonstrates an error when a requested model name does not exist in the current workspace.

wl.get_model(name="no-such-model")

---------------------------------------------------------------------------

Exception                                 Traceback (most recent call last)

/tmp/ipykernel_208/498292295.py in <module>
----> 1 wl.get_model(name="no-such-model")


~/.local/lib/python3.9/site-packages/wallaroo/client.py in get_model(self, name, version)
    1182         )
    1183         if model is None:
-> 1184             raise Exception(f"Error: A model with the name {name} does not exist.")
    1185         if version is not None:
    1186             model_version = next(

Exception: Error: A model with the name no-such-model does not exist.
Get Model No Matching Model Version Error Example

The following demonstrates an error when a requested model version does not exist for the specified model.

model_name="helper-demo-model-1"

wl.get_model(name=model_name, version="no-such-version")

---------------------------------------------------------------------------

Exception                                 Traceback (most recent call last)

/tmp/ipykernel_208/3669316954.py in <module>
----> 1 wl.get_model(name=model_name, version="no-such-version")


~/.local/lib/python3.9/site-packages/wallaroo/client.py in get_model(self, name, version)
    1190                 return model_version
    1191             else:
-> 1192                 raise Exception(
    1193                     f"Error: A model with the version {version} not found in this workspace."
    1194                 )

Exception: Error: A model with the version no-such-version not found in this workspace.

List Models Across Workspaces

The method wallaroo.client.list_models() lists all models the current workspace.

List Models Across Workspaces Parameters

None.

List Models Across Workspaces Returns

wallaroo.client.list_models() returns wallaroo.model.ModelList which is a List of wallaroo.model.Model. Each Model has the following attributes.

FieldTypeDescription
idIntegerThe numerical identifier of the model.
nameStringThe name of the model.
owner_idStringThe Wallaroo model owner identifier.
last_update_timeDatetimeThe DateTime the model was last updated.
created_atDatetimeThe DateTime the model was created.
versionsIntegerThe number of versions of the model.

List Models Across Workspaces Example

The following example retrieves a list of all models in workspaces the user is a member of in a Wallaroo instance, then selects one model from the list to display its details.

import wallaroo

wl = wallaroo.Client()

display(wl.list_models())
Name# of VersionsOwner IDLast UpdatedCreated At
mlflowpostprocess1""2024-01-30 16:11:56.917877+00:002024-01-30 16:11:56.917877+00:00
mlflowstatmodels1""2024-01-30 16:11:55.848172+00:002024-01-30 16:11:55.848172+00:00
modeltest = wl.list_models()[0]
display(modeltest)
Namemlflowpostprocess
# of Versions1
Owner ID""
Last Updated2024-01-30 16:11:56.917877+00:00
Created At2024-01-30 16:11:56.917877+00:00

List Models Within A Workspace

Models are listed from a workspace with the wallaroo.workspace.Workspace.models() methods.

List Models Within A Workspace Parameters

N/A

List Models Within A Workspace Returns

returns wallaroo.model.ModelList which is a List of wallaroo.model.Model. Each Model has the following attributes.

FieldTypeDescription
idIntegerThe numerical identifier of the model.
nameStringThe name of the model.
owner_idStringThe Wallaroo model owner identifier.
last_update_timeDatetimeThe DateTime the model was last updated.
created_atDatetimeThe DateTime the model was created.
versionsIntegerThe number of versions of the model.

List Models Within A Workspace Example

The following example retrieves a workspace, lists all of the models in that workspace, then select one models and displays its details.

import wallaroo

wl = wallaroo.Client()

workspace = wl.list_workspaces()[1]
print(workspace)

{'name': 'unet-detection', 'id': 7, 'archived': False, 'created_by': 'df2b4a6c-b749-466a-95b4-60cf14fc354d', 'created_at': '2024-01-18T19:56:59.030291+00:00', 'models': [{'name': 'pt-unet', 'versions': 2, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 1, 18, 19, 58, 12, 603652, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 1, 18, 19, 57, 0, 984506, tzinfo=tzutc())}], 'pipelines': [{'name': 'pt-unet', 'create_time': datetime.datetime(2024, 1, 18, 20, 8, 13, 687565, tzinfo=tzutc()), 'definition': '[]'}]}

sample_model_list = workspace.models()
print(sample_model_list)

[{'name': 'pt-unet', 'versions': 2, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 1, 18, 19, 58, 12, 603652, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 1, 18, 19, 57, 0, 984506, tzinfo=tzutc())}]

sample_model = sample_model_list[0]
print(sample_model)

{'name': 'pt-unet', 'versions': 2, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 1, 18, 19, 58, 12, 603652, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 1, 18, 19, 57, 0, 984506, tzinfo=tzutc())}
Namept-unet
# of Versions2
Owner ID""
Last Updated2024-01-18 19:58:12.603652+00:00
Created At2024-01-18 19:57:00.984506+00:00

List Model Versions

A list of versions of a model are retrieved from the wallaroo.model.Model.versions() method.

List Model Versions Parameters

N/A

List Model Versions Returns

A List of wallaroo.model_version.ModelVersion associated with the Model. Each Model Version includes:

FieldTypeDescription
nameStringThe name assigned to the model version. This matches the Model name the model version is assigned to.
versionStringThe model version identifier in UUID format.
file_nameStringThe file name for an uploaded model version.
image_pathStringThe image path of a registered model version.
arch**StringNULL**
last_update_timeDatetimeThe DateTime the model version was last updated.

List Model Versions Example

The following example retrieves a model, lists the model versions, then retrieves a specific model version from the List of model versions.

print(sample_model)

{'name': 'pt-unet', 'versions': 2, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 1, 18, 19, 58, 12, 603652, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 1, 18, 19, 57, 0, 984506, tzinfo=tzutc())}


print(sample_model.versions())

[{'name': 'pt-unet', 'version': '8a9e998c-6758-4868-b7ca-ba910ba3d70c', 'file_name': 'unet.pt', 'image_path': None, 'arch': None, 'last_update_time': datetime.datetime(2024, 1, 18, 19, 58, 3, 394868, tzinfo=tzutc())},
 {'name': 'pt-unet', 'version': '9bbb0039-074b-4a49-8c3a-e86a543dcbb7', 'file_name': 'unet.pt', 'image_path': 'proxy.replicated.com/proxy/wallaroo/ghcr.io/wallaroolabs/mlflow-deploy:v2023.4.1-4351', 'arch': None, 'last_update_time': datetime.datetime(2024, 1, 18, 20, 2, 44, 866594, tzinfo=tzutc())}]

print(sample_model.versions()[-1])

{'name': 'pt-unet', 'version': '9bbb0039-074b-4a49-8c3a-e86a543dcbb7', 'file_name': 'unet.pt', 'image_path': 'proxy.replicated.com/proxy/wallaroo/ghcr.io/wallaroolabs/mlflow-deploy:v2023.4.1-4351', 'arch': None, 'last_update_time': datetime.datetime(2024, 1, 18, 20, 2, 44, 866594, tzinfo=tzutc())}

Get Model Config

The model versions configuration defines how the model is used in the Wallaroo Inference Engine. Settings include:

  • The runtime
  • Input and output schemas
  • Tensor field name overrides

The model version configuration is retrieved with the method wallaroo.model_version.ModelVersion.config().

Get Model Config Parameters

N/A

Get Model Config Returns

The method wallaroo.model_version.ModelVersion.config() returns wallaroo.model_config.ModelConfig. The following fields are part of the model config object.

MethodReturn TypeDescription
id()IntegerThe id of model version the configuration is assigned to.
to_yaml()StringA YAML output of the model configuration options that are not None.
tensor_fields()List[String]A list of tensor field names that override the default model fields. Only applies to onnx models.
model_version()wallaroo.model_version.ModelVersionThe model version the model configuration is assigned to.
runtime()StringThe model runtime as defined by wallaroo.framework.Framework

Get Model Config Example

The following examples retrieves a model version, and displays the fields from the methods listed above.

print(model_config.runtime())

flight