Model Serve > User-defined models > Registering a machine learning model
  

Registering a machine learning model

To get started with Model Serve, register a machine learning model based on a trained machine learning algorithm.
When you register a machine learning model, Model Serve uploads the model files to an internal file store. After you register a model, you can use it in one or more model deployments.
To configure a machine learning model, perform the following steps:
  1. 1Define general properties for the model.
  2. 2Upload the model artifacts as a ZIP file.
  3. 3Define the input fields that the model expects and the output fields that the model returns.
After you save the machine learning model, the overview page appears. Users in your organization can download the model artifacts from the overview page.
If you need to edit a machine learning model, stop all model deployments that use the model. You can't edit a machine learning model if a running model deployment uses it.

Define a machine learning model

Create a machine learning model and configure the general properties.
    1In the navigation bar, select New > Machine Learning Model.
    2Configure general properties for the model. The following tables describes the properties to configure:
    Property
    Description
    Model name
    Required. Name of the machine learning model.
    The name must begin with a letter and can contain alphanumeric characters, hyphens (-), and underscores (_). Maximum length is 100 characters.
    Description
    Description of the machine learning model.
    Location
    Required. Project folder in which the machine learning model resides.
    If the Explore page is currently active and a project or folder is selected, the default location for the machine learning model is the selected project or folder. Otherwise, the default location is the Default folder.

Upload model artifacts

Download and edit the code template, and then upload the model artifacts.
    1Select Custom as the framework.
    2Download and unzip the code template.
    The code template includes the files predict.py and requirements.txt.
    3Edit the predict.py file to define the entry point into your custom algorithm files. Define the __init__() method to load your model files when the model deployment starts. Define the predict() method to take a JSON-formatted request and return a prediction from the model.
    Note: Defining the __init__() method isn't required. If you don't define the method, the model deployment loads the model files for each request, which slows down the performance of the deployment.
    4Edit the requirements.txt file to list the third-party libraries required to run your machine learning algorithm.
    For example, the file might contain the following list:
    scikit-learn
    scipy
    tensorflow
    numpy==1.19.5
    Note: If you don't specify a version for a library, Model Serve uses the newest version. Ensure that the library versions you use are compatible with KServe 0.8.0. If the library version that's compatible with KServe 0.8.0 isn't compatible with another library that your model needs, contact Informatica Global Customer Support to upgrade your version of KServe.
    5Compress predict.py, requirements.txt, and your algorithm files into a ZIP file. The file can be up to 3 GB. The predict.py and requirements.txt files must be at the root level in the ZIP file.
    6Upload the ZIP file as the model file.

Define input and output fields

Define the input fields that the model expects in API requests and output fields that the model returns in API responses.
On the Fields tab, add the name and data type of each input and output field. Configure at least one input field and output field.
The following image shows the Fields tab:
The Fields tab is open for a new machine learning model. There is one input field named "test_pixels" with data type set to "array of float" and shape set to "[28, 28]." There is one output field named "classify" with data type set to "array of float" and shape set to "[1, 10]."
Note: When you output a user-defined object, ensure that the predict() method returns a serialized JSON string, and then configure a string output field.