Overview
  • 24 Nov 2021
  • 3 Minutes to read
  • Dark
    Light

Overview

  • Dark
    Light

Use Model Manager to bring your analytics models (e.g. machine learning) into your real-world operations.

With Model Manager you can upload packaged machine learning models to MAIO. MAIO will then take care of serving these models and exposing them, via API, so that they can actually be used to produce inference (e.g. in a Studio notebook).

Preparing a model

Model Manager supports MLFlow packages. This gives you a wide range of options for creating your models whether you use Scikit-Learn, TensorFlow or even plain Python functions (see the MLFlow documentation for full details of supported frameworks).

To prepare a model package for MAIO:

  1. Create your MLFlow package following the guidelines for the relevant framework in the MLFlow documentation
  2. Compress the package (Model Manager supports zip, .tar.gz, .tar.bz, .tar.bz2 and .tar.xz formats)

Model Management

This section describes how you can work with models in Model Manager.

Create a New Model Manager Model

Once you have a compressed MLFlow package you can upload it to Model Manager:

  1. Login to MAIO and open Model Manager

  2. Click "New" to start adding a new model

  3. Give your new model a name (required) and a description (optional)

  4. Choose your (compressed) MLFlow package

  1. Toggle the deployment setting if you want your model to be deployed and ready for use as soon as you upload it
  2. Click "Verify" to check your package

  1. If everything is okay click "Register" to finalise the upload. The new model will appear selected in the model list with the details view showing (the model will take a short time to register before being available or "live")

Version Management

Model Manager makes it easy to create new versions of models. This is useful if you want to keep developing a model but need to retain previous versions and rollback if necessary.

Creating Versions

To create a new version of an existing model:

  1. Select the desired model and click "Create Version"

  1. Browse and choose the model pacakge you want to upload
  2. If you want your model to be deployed and ready for use as soon as you upload it then toggle the deployment setting
  3. Click "Verify" to check your package
  4. If everything is okay click "Register" to finalise the upload. The new version will appear in the versions list along with previous versions (the model will take a short time to register before being available or "live")

Undeploy (and Redeploy) a Model Version

To undeploy a version so that it is no longer live (but still stored in the system):

  1. Select the model version(s) you wish to undeploy
  2. Click "Undeploy" and confirm

To redeploy a model version that has been undeployed:

  1. Select the model version(s) (that was/were undeployed)
  2. Click "Deploy" and confirm

Delete a Model Version

To permanently remove a model version from MAIO:

  1. Select the model version(s) you want to remove
  2. Click "Delete" and confirm

Test the Model

The "Test" tab in the model details view provides an easy interface for testing the model.

To test model inference:

  1. Make sure the "Test" tab is selected
  2. Prepare some data (see the "Prepare the Data" section below)
  3. Paste the data into the input field
  4. Select the version of the model you want to run (only live models will show in the version selector dropdown)
  5. Press "Play" to run the model using the data you provided. The results will be displayed in the inference field.

Prepare the Data

Model Manager requires data in a specific format.

The easiest way to create correctly formatted input data is to use the Pandas Python package.

In this example we will prepare data for a model that expects two inputs (integers). The model inputs are named input_1 and input_2

  1. Create a list with your input data (this must contain the correct number of columns (in this example there are two inputs)
input_1 = 3
input_2 = 5
the_data = [[input_1, input_2]]
  1. Create a Pandas dataframe using the data. The columns must be named to agree with the model definition (in this example the model's inputs were named input_1 and input_2)
data_frame = pandas.DataFrame(the_data, columns=["input_1", "input_2"])
  1. Convert the data frame to JSON using the to_json function
data_frame.to_json(orient="split")
  1. You can now use the returned JSON as an input for Model Manager

Was this article helpful?

What's Next