You can use the cloud-native AI suite to manage models in MLflow Model Registry. This topic describes how to use the Arena CLI to manage models.
Background information
MLflow is an open source machine learning lifecycle management platform, which can be used to track model training information, manage machine learning models, and deploy machine learning models. For more information about MLflow Model Registry, see MLflow Model Registry - MLflow documentation.
Prerequisites
A Container Service for Kubernetes (ACK) Pro cluster that runs Kubernetes 1.20 or later is created. For more information, see Create an ACK Pro cluster.
A Resource Access Management (RAM) user is created in the RAM console and associated with a quota group. For more information, see Create a RAM user. For more information about how to associate quota groups with RAM users, see Step 1: Create a quota group for the RAM user.
The MLflow component is deployed in the
kube-ainamespace of the ACK cluster. For more information, see Configure MLflow Model Registry.To use Arena to manage models, configure the Arena client. The Arena version must be 0.9.14 or later. For more information, see Configure the Arena client.
Use Arena to manage models
For more information about how to use Arena to manage models, see Model Manage Guide - Arena Documentation.
Add model versions
Run the following command to add a model version:
arena model create \
--name my-model \
--tags key1,key2=value2 \
--description "This is some description about my-model" \
--version-tags key3,key4=value4 \
--version-description "This is some description about my-model v1" \
--source pvc://my-pvc/models/my-model/1Expected output:
INFO[0000] registered model "my-model" created
INFO[0000] model version 1 for "my-model" created Query registered models or model versions
Query registered models
Run the following command to query a registered model named
my-model:arena model get \ --name my-modelExpected output:
Name: my-model LatestVersion 1 CreationTime: 2024-04-29T16:15:26+08:00 LastUpdatedTime: 2024-04-29T16:44:17+08:00 Description: This is some description about my-model! Tags: key1: key2: value2 Versions: Version Source --- --- 1 pvc://my-pvc/models/my-model/1Query model versions
Run the following command to query a model version whose model name is
my-modeland version number is1:arena model get \ --name my-model \ --version 1Expected output:
Name: my-model Version: 1 CreationTime: 2024-04-29T16:42:18+08:00 LastUpdatedTime: 2024-04-29T16:42:18+08:00 Source: pvc://my-pvc/models/my-model/1 Description: This is some description about my-model v1 Tags: createdBy: arena key3: key4: value4
List all registered models
Run the following command to list all registered models:
arena model list Update registered models or model versions
Run the following command to update a registered model named my-model:
arena model update \
--name my-model \
--description "This is some updated description" \
--tags key1=updatedValue1,key2=updatedValue2 Expected output:
INFO[0000] model version "my-model/1" updated To delete the tags of a model, append hyphens (-) to the tags. In the following example, the key1, key2=value2, key3, and key4=value4 tags are deleted:
arena model update \
--name my-model \
--tags key1-,key2=value2- \
--version 1 \
--version-tags key3-,key4=value4-Delete registered models or model versions
Deleting a registered model also deletes all model versions associated with the model. Proceed with caution.
Delete registered models
For example, you can run the following command to delete a registered model named
my-model:arena model delete \ --name my-modelTo prevent user errors, the system prompts you to confirm whether to delete the specified model when you run the preceding command. Enter
yesornoto confirm.If you use automated scripts or you do not need to confirm the deletion operation, add
--forceto skip the confirmation step and directly delete the model. Example:arena model delete \ --name my-model \ --forceDelete model versions
For example, you can run the following command to delete a model version whose model name is
my-modeland version number is1:arena model delete \ --name my-model \ --version 1To prevent user errors, the system prompts you to confirm whether to delete the specified model version when you run the preceding command. Enter
yesornoto confirm.If you use automated scripts or you do not need to confirm the deletion operation, add
--forceto skip the confirmation step and directly delete the model version. Example:arena model delete \ --name my-model \ --version 1 \ --force