Model Template Overview

Because the configurations of models of the same function are similar, ModelArts integrates the configurations of such models into a common template. By using this template, you can easily and quickly import models without compiling the config.json configuration file. In simple terms, a template integrates AI engine and model configurations. Each template corresponds to a specific AI engine and inference mode. With the templates, you can quickly import models to ModelArts.

Background

Templates are classified into general and non-general templates.

  • Non-general templates are customized for specific scenarios with the input and output mode fixed. For example, the TensorFlow-based image classification template uses the built-in image processing mode.
  • General templates integrate a specific AI engine and running environment and use the undefined input and output mode. You need to select an input and output mode based on the model function or application scenario to overwrite the undefined mode. For example, an image classification model requires the built-in image processing mode, and an object detection model requires the built-in object detection mode.

    The models imported in undefined mode cannot be deployed as batch services.

Using a Template

The following uses the TensorFlow-based image classification template (For details, see TensorFlow-py36 General Template.) as an example. You need to upload the TensorFlow model package to OBS in advance. Store the model files in the model directory. When creating a model using this template, you need to select the model directory.

  1. On the Import Model page, set Meta Model Source to Template.
  2. In the Template area, select TensorFlow-based image classification template.

    ModelArts also provides three filter criteria: Type, Engine, and Environment, helping you quickly find the desired template. If the three filter criteria cannot meet your requirements, you can enter keywords to search for the target template.

    Figure 1 Selecting a template
  3. For Model Folder, select the model directory where the model files reside. For details, see Template Description.

    If a training job is executed for multiple times, different version directories are generated, such as V001 and V002, and the generated models are stored in the model folder in different version directories. When selecting model files, specify the model folder in the corresponding version directory.

  4. If the default input and output mode of the selected template can be overwritten, you can select an input and output mode based on the model function or application scenario. Input and Output Mode is an abstract of the API in config.json. It describes the interface provided by the model for external inference. An input and output mode describes one or more APIs, and corresponds to a template.

    For example, for TensorFlow-based image classification template, Input and Output Mode supports Built-in image processing mode. The input and output mode cannot be modified in the template. Therefore, you can only view but not modify the default input and output mode of the template on the page.

    For details about the supported input and output modes, see Input and Output Modes.