Model Registry

Prev Next

Available in VPC

You can learn the Model Registry interface configuration. In Model Registry, you can view the metadata about a model created as an intermediate result during the training process and the final model.

Note

You can use the features provided by Model Registry in the same way through CLI and SDKs provided by ML expert Platform.

Model Registry

The basic description for the Model Registry home interface is as follows:

mlxp_console_modelregistry01_ko

Component Description
① Menu name Current menu name.
② Basic features Create and delete the model metadata.
③ Model list View the list of the saved models and their information.

View Model Registry list

The information about the list of models you saved is as follows:

  • Name: Name of the volume you set upon initial creation
  • Tags: Tag information for version management
  • Created At: Initial time of creation

Create model

To create new metadata of the model:

  1. Click [Create].
  2. In the new model metadata creation interface, enter the model name.
    • Must be 3-64 characters long. They must contain lowercase letters (a-z), numbers (0-9), and/or hyphens.
    • Begin with a letter and end with a letter or number.
    • Duplication is not allowed.
  3. Enter the summary.
    • Must be a maximum of 100 characters. They must contain letters (a-z, A-z), numbers (0-9), and/or hyphens.
  4. Enter the description.
  5. Enter the tag information.
    • Enter up to 10 items.
  6. Enter the label information.
    • Enter up to 100 items.
  7. Click [Create].

Delete model

You can delete the meta information of the model.

  1. Select the model to be deleted and click [Delete].
  2. In the model deletion popup window, enter the name of the model you want to delete and click [Delete].
  3. From the model list, verify that the model has been deleted.

View model details

You can view the details about the model you selected. The details are divided into tabs.

Description

The details about the selected model are as follows:

  • Tags: Tag information for model version management
  • Labels: Model label information in a Key:Value structure
  • Description: Description written upon creating model metadata

Versions and Files

You can view the metadata about the model you selected.

  • Version: Information about the model version
  • Size: Size of the model
  • Download: Number of model downloads
  • Tags/Labels: Tag and label information set in the model
  • Updated at: Last edited date

Settings

You can edit the description information of the model you selected.

  • Tags: Tag information for model version management
  • Labels: Model label information in a Key:Value structure
  • Description: Description written upon creating model metadata

Use Model Registry CLI

Model Registry CLI provides tools for managing models in the command line.

Install CLI

You can install CLI using the following commands:

pip install "ncloud-mlx[model-registry]" # double quotes are required

CLI settings

To use CLI, an API key is required. For more information about how to create the API key, see Dashboard.

Method 1: Configure environment variables.

You can configure environment variables as follows:

export MLX_ENDPOINT_URL="https://your-mlx-endpoint"
export MLX_APIKEY="your-api-key" 
export MLX_PROJECT="your-project-name"

Method 2: Use mlx configure (recommended).

Run the following commands to enter the settings:

$ mlx configure
Endpoint: https://... # mlx endpoint you are using. Example: https://clustername.mlxp.ncloud.com
Workspace name: xxxx # Workspace to be used
Project name: xxxx # Project to be used
API Key: xxxx # API key issued

How to use CLI

Create model

mlx model-registry create model {model_name}

Create version

mlx model-registry create version {model_name} {version}

Upload model

mlx model-registry upload {model_name} {version} ./local_path

Download model

mlx model-registry download {model_name} {version} ./output_path

Other commands

# View model information
mlx model-registry get {model_name}

# View version information
mlx model-registry get {model_name} {version}

# Update model
mlx model-registry update model {model_name}

# Update version
mlx model-registry update version {model_name} {version}

# Delete model
mlx model-registry delete {model_name}

# Delete file
mlx model-registry delete {model_name} {version} {file_path}

# Help
mlx model-registry --help
Note

You can use the --help option to view detailed options and usage methods about each command.
Example: mlx model-registry upload --help and mlx model-registry download --help

Use Model Registry SDKs

Model Registry SDKs provides Python-based SDKs.
To upload/download the model parameter through SDKs:

Install SDKs

You can install SDKs using the following commands:

# This package is the same as cli, so you can use it after installing cli.
pip install "ncloud-mlx[model-registry]" # double quotes are required

Prerequisites

To use SDKs, you must create API key.

Method 1: Enter manually.

You can manually enter the API key you created for your use.

import os
from mlx.sdk.model_registry import ModelRegistryAPI

mlxp_endpoint = "{ Model Registry URL }"
mlxp_apikey = "{ API Key }"
mlxp_project = "{ project name }"

client = ModelRegistryAPI(mlxp_endpoint, mlxp_apikey)

Method 2: Configure environment variables.

You can configure environment variables as follows:

export MLX_ENDPOINT_URL="https://your-mlx-endpoint"
export MLX_APIKEY="your-api-key" 
export MLX_PROJECT="your-project-name"

After configuring environment variables, you can use them as follows in SDKs:

from mlx.sdk.model_registry import ModelRegistryAPI
import os

mlxp_endpoint = os.getenv("MLX_ENDPOINT_URL")
mlxp_apikey = os.getenv("MLX_APIKEY")
mlxp_project = os.getenv("MLX_PROJECT")

client = ModelRegistryAPI(mlxp_endpoint, mlxp_apikey)

Method 3. Use mlx configure (recommended).

Run the following commands to enter the settings:

$ mlx configure
Endpoint: https://... # mlx endpoint you are using. Example: https://clustername.mlxp.ncloud.com
Workspace name: xxxx # Workspace to be used
Project name: xxxx # Project to be used
API Key: xxxx # API key issued

After the configuration is complete, you can use them as follows in SDKs:

from mlx.sdk.core import config
from mlx.sdk.model_registry import ModelRegistryAPI

# Automatically import settings from the config file
# (If environment variables are set, the values set through environment variables are automatically overridden.)
mlxp_endpoint = config.ConfigFile().endpoint_url
mlxp_apikey = config.ConfigFile().apikey
mlxp_project = config.ConfigFile().project

client = ModelRegistryAPI(mlxp_endpoint, mlxp_apikey)

Create model registry

To upload/download the model parameter in SDKs, a model registry must be created.

Create model

To create a model using SDKs:

from mlx.sdk.model_registry import ModelRegistryAPI
from mlx.api.model_registry import ModelRequest

# Initialize client (using one of the above settings methods)
client = ModelRegistryAPI(mlxp_endpoint, mlxp_apikey)

# Request for model creation
model_request = ModelRequest(name="my_model")
model = client.model_api.create(mlxp_project, model_request)
print(f"model creation complete: {model.name}")

Create model version

To add a version to the model created:

from mlx.api.model_registry import VersionRequest

# Request for version creation
version_request = VersionRequest(version="v1.0")
version = client.model_version_api.create(mlxp_project, "my_model", version_request)
print(f"model version creation complete: {version.name}")

Upload model parameter

To upload model parameter:

# Write the progress status of the model parameter upload and the completion callback
def progress_callback(progress_size: int, total_size: int):
    print(f"upload progress: {progress_size}/{total_size} bytes")

def completion_callback(file_path: str, size: int):
    print(f"upload complete: {file_path} ({size} bytes)")

# Perform a file upload
client.file_api.upload_sync(
    project_name=mlxp_project,
    model_name="my_model",
    version_name="v1.0", 
    local_path="/path/to/local/files",
    remote_path="/",
    # Optional parameters:
    excludes=[], # List of the files to be excluded
    overwrite=True, # If a file exists, whether to overwrite it
    parallel=1, # Number of parallel workers
    progress_callback_func=progress_callback,
    file_complete_callback_func=completion_callback,
)

Download model parameter

To download model parameter:

# Write the progress status of the model parameter download and the completion callback
def progress_callback(progress_size: int, total_size: int):
    print(f"download progress: {progress_size}/{total_size} bytes")

def completion_callback(file_path: str, size: int):
    print(f"download complete: {file_path} ({size} bytes)")
    
# Perform a file download
client.file_api.download_sync(
    project_name=mlxp_project,
    model_name="my_model",
    version_name="v1.0", 
    remote_path="/",
    local_path="/path/to/download",
    # Optional parameters:
    overwrite=True, # if a file exists, whether to overwrite it
    parallel=1, # number of parallel workers
    progress_callback_func=progress_callback,
    file_complete_callback_func=completion_callback,
)