Compressing and Converting Models

To obtain higher computing power, you can deploy the models created on ModelArts or a local PC on the Ascend chip. In this case, you need to compress or convert the models to the required formats before deploying them.

ModelArts supports model conversion, allowing you to convert a model to a required format before deploying the model on a chip with higher computing power and performance.

Model conversion applies to the following scenarios:

Constraints

Creating a Model Compression/Conversion Task

  1. Log in to the ModelArts management console, and choose Model Management > Compression/Conversion in the left navigation pane. The Compression/Conversion page is displayed.
  2. Click Create Task in the upper left corner to create a task.
  3. On the Create Task page that is displayed, set the required parameters based on Table 1.
    Table 1 Parameters

    Parameter

    Description

    Name

    Name of a model conversion task

    Description

    Description of a model conversion task

    Conversion Template

    ModelArts provides various templates to define model conversion and the parameters required during the conversion.

    Conversion Templates details the supported model conversion templates. You can select a template from the template list. Alternatively, you can enter a keyword in the search box to search for a template, or select a template based on the chip type, framework type, or model file format.

    • Chip type: ModelArts conversion templates support Ascend chips.
    • Framework type: The conversion templates generate models in different formats based on different frameworks. The TensorFlow framework is supported.
    • Model file format: The supported model file formats are listed in the drop-down list. Select a format from the drop-down list. The frozen_graph and tf_serving formats are supported.

    Conversion Input Path

    Path to the model to be converted. The path must be an OBS path and comply with the ModelArts specifications. For details about the specifications, see Model Input Path Specifications.

    Conversion Output Path

    Path to the converted model. The path must comply with the ModelArts specifications. For details about the specifications, see Model Output Path Description.

    Advanced Settings

    ModelArts allows you to configure advanced settings for different conversion templates, for example, the precision.

    Different conversion templates support different advanced settings. For details about the parameters supported by each template, see Conversion Templates.

    Figure 1 Creating a model compression/conversion task
  4. After entering the task information, click Create Now in the lower right corner.

    After the task is created, the system automatically switches to the Compression/Conversion page. The created conversion task is displayed on the page and is in the Initializing status. The conversion task takes several minutes to complete. When the task status changes to Successful, the task is complete and the model has been converted.

    If the task status changes to Failed, click the task name to go to the task details page, view the log information, adjust task parameters based on the log information, and create another conversion task.

Deleting a Model Compression/Conversion Task

You can delete unnecessary conversion tasks. However, tasks in the Running or Initializing status cannot be deleted.

Deleted tasks cannot be recovered. Exercise caution when performing this operation.