All Products
Search
Document Center

:model quantize

Last Updated:Sep 02, 2024

The model quantize component provides mainstream model quantization algorithms for you to compress and accelerate models. This way, high-performance inference can be implemented. This topic describes how to configure the model quantize component and provides an example on how to use the component.

Prerequisites

OSS is activated, and Machine Learning Studio is authorized to access OSS. For more information, see Activate OSS and Grant the permissions that are required to use Machine Learning Designer.

Limits

  • The model quantize component is available only in Machine Learning Designer of Machine Learning Platform for AI.

  • You can use the model quantize component based only on the computing resources of Deep Learning Containers (DLC) of Machine Learning Platform for AI.

  • If an object detection component is configured as an upstream component of the model quantize component, make sure that the model-related configurations and the dataset configurations for the two components are the same.

Configure the component in Machine Learning Designer

  • Input ports

    Input port (left-to-right)

    Data type

    Recommended upstream component

    Required

    Input model

    Object Storage Service (OSS)

    object detection or model prune

    No

    Training data

    OSS

    Read File Data

    Yes

    Test data

    OSS

    Read File Data

    Yes

    Category file

    OSS

    Read File Data

    Yes

  • Component parameters

    Tab

    Parameter

    Description

    Fields Setting

    model type

    The type of the model to train. Valid values:

    • YOLOX

    • YOLOX_EDGE

    Default value: YOLOX_EDGE.

    oss dir to save model

    The OSS path in which the model and logs are stored during training.

    oss path to training tfrecord

    The OSS path of the file that contains the training data. If a Read File Data component is configured as an upstream component of the model quantize component, you do not need to set this parameter.

    oss annotation path for training set

    The OSS path of the file that contains the labeling results of the training dataset.

    oss path to evaluation tfrecord

    The OSS path of the file that contains the test data. If a Read File Data component is configured as an upstream component of the model quantize component, you do not need to set this parameter.

    oss annotation path for validataion set

    The OSS path of the file that contains the labeling results of the test dataset.

    oss path of class list file

    The OSS path of the category file. If a Read File Data component is configured as an upstream component of the model quantize component, you do not need to set this parameter.

    YOLOX data format

    The format of the datasets. Valid values:

    • COCO

    • DetSourcePAI

    Default value: COCO.

    oss path to pretrained model

    The OSS path in which your pre-trained model is stored. If you have a pre-trained model, set this parameter to the OSS path of your pre-trained model. This parameter is optional.

    Parameters Setting

    YOLOX edge model type

    The type of the YOLOX preset model. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    Default value: yolox-customized.

    YOLOX model type

    This parameter is required only if you set the model type parameter to YOLOX on the Fields Setting tab.

    Valid values:

    • yolox-s

    • yolox-m

    • yolox-l

    • yolox-x

    Default value: yolox-s.

    yolox_edge_model_depth

    The depth of the YOLOX model. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    The value is a floating-point number. Default value: 1.0. Valid values: 0.01 to 1.0.

    yolox_edge_model_width

    The width of the YOLOX model. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    The value is a floating-point number. Default value: 1.0. Valid values: 0.01 to 1.0.

    YOLOX edge model activation

    The type of the activation function for the YOLOX model. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    Valid values:

    • relu

    • lrelu

    • silu

    • hsilu

    Default value: relu.

    test confidence:[0.01,1.0]

    The confidence level of the test. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    The value is a floating-point number. Default value: 0.01. Valid values: 0.01 to 1.0.

    nms threshold:[0.01,1.0]

    The Non-Maximum Suppression (NMS) threshold. This parameter is required only if you set the model type parameter to YOLOX_EDGE on the Fields Setting tab.

    The value is a floating-point number. Default value: 0.65. Valid values: 0.01 to 1.0.

    num classes

    The number of categories.

    image scale

    The resolution of resized images for YOLOX. The value is in the format of Height Width. Default value: 640 640.

    initial learning rate

    The initial learning rate for model training. The value is a floating-point number. Default value: 0.01.

    train batch size

    The size of a training batch. Specifically, this parameter specifies the number of data samples used for training in a single model iteration process. Default value: 16.

    eval batch size

    The size of an evaluation batch. Specifically, this parameter specifies the number of data samples used for evaluation in a single model iteration process. Default value: 1.

    num epochs

    The total number of training epochs. Default value: 20.

    warmup epochs

    The number of epochs for the warm-up strategy. Default value: 5.

    last no augmented lr epochs

    The number of epochs to complete after the learning rate is stable if the warm-up strategy is used. Default value: 5.

    save checkpoint epoch

    The interval at which a checkpoint is saved. The interval is measured in epochs. Default value: 1. The default value indicates that a checkpoint is saved every time an epoch is complete.

    Tuning

    io thread num for training

    The number of threads that are used to read the training data.

    single worker or distributed on MaxCompute or DLC

    The compute engine that is used to run the component. The system automatically sets this parameter based on the type of the training model that you select.

    number of worker

    The number of workers used for distributed training. Default value: 1.

    gpu machine type

    The instance type of the GPU-accelerated instance to be used. Default value: 8vCPU+32GB Mem+1xv100-ecs.gn6v-c8g1.2xlarge.

Example

The following figure shows a sample pipeline in which the model quantize component is used. PipelineIn this example, the components are configured by performing the following steps:

  1. Perform data labeling by using iTAG. For more information, see iTAG.

  2. Use the Read File Data-1, Read File Data-2, and Read File Data-3 components to read the training dataset, test dataset, and category file. You can configure the dataset to be read for a Read File Data component by setting the OSS Data Path parameter to the OSS path of the training dataset, test dataset, or category file.

  3. Use the object detection-1 component to create an object detection model.

  4. Use the Read File Data-4, Read File Data-5, and Read File Data-6 components to read the training dataset, test dataset, and category file. You can configure the dataset to be read for a Read File Data component by setting the OSS Data Path parameter to the OSS path of the training dataset, test dataset, or category file.

  5. Connect the object detection-1, Read File Data-4, Read File Data-5, and Read File Data-6 components to the model quantize component and set the component parameters. For more information, see the "Configure the component in Machine Learning Designer" section of this topic.