Quantization Configuration Parameters

Table 1 retrain_enable

Description

QAT enable

Type

bool

Value

true or false

Command-Line Options

  • true: on
  • false: off

Recommended

true

Required/Optional

This function is optional.

Table 2 retrain_data_config

Description

Activation quantization configuration

Type

dict

Value

-

Command-Line Options

Includes the following parameters:

  • batch_num: batch number used for quantization.
  • clip_max: upper bound of clipping-based quantization, defaulted to be empty.
  • clip_min: lower bound of clipping-based quantization, defaulted to be empty.
  • fixed_min: whether to fix the minimum value of clipping-based quantization to 0, defaulted to be empty.
  • dst_type: Currently, only INT8 quantization bit width is supported. The default value is INT8.

Recommended Value

-

Required/Optional

This function is optional.

Table 3 retrain_weight_config

Description

Weight quantization configuration

Specification

dict

Value

-

Command-Line Options

Includes the following parameters:

  • algo: quantization algorithm select, defaulted to arq_retrain.
  • Whether to use different quantization factors for each channel.
  • dst_type: Currently, only INT8 quantization bit width is supported. The default value is INT8.

Recommended Value

-

Required/Optional

This function is optional.

Table 4 weights_retrain_algo parameters

Description

Quantization algorithm

Type

string

Value

-

Command-Line Options

  • ulq_quantize: ULQ clipping-based quantization algorithm
  • arq_retrain: ARQ quantization algorithm

Recommended Value

arq_retrain

Required/Optional

Optional

Table 5 channel_wise

Description

Whether to use different quantization factors for each channel

Specification

bool

Value

true or false

Command-Line Options

  • true: Channels are separately quantized using different quantization factors.
  • false: All channels are quantized altogether using the same quantization factors.

Recommended

true

Required/Optional

This function is optional.

Table 6 batch_num

Description

Batch count used for quantization.

"Type"

int

The options are as follows:

Greater than 0

Command-line options

Defaults to 1. You are advised to keep the calibration dataset size within 50 images. Calculate batch_num based on batch_size as follows:

batch_num x batch_size = Calibration dataset size

batch_size indicates the number of images per batch.

Recommended Value

1

Required/Optional

This function is optional.

Table 7 fixed_min

Description

Fixed lower bound switch for the activation quantization algorithm

Type

bool

Value

true or false

Parameter Description

  • true: fixes the lower bound of the activation quantization algorithm at 0.
  • false: does not fix the lower bound of the activation quantization algorithm.

Recommended Value

Do not include this parameter.

Required/Optional

This function is optional.

Table 8 clip_max

Description

Upper bound for the activation quantization algorithm

Type

float

Value

clip_max>0

Find the maximum max based on the distribution of the activation values at different layers. The recommended value range is [0.3 x max, 1.7 x max].

Command-Line Options

If this parameter is included, the upper bound of the clipping-based activation quantization algorithm is fixed. If this parameter is not included, the upper bound is learned using the IFMR algorithm.

Recommended Value

Do not include this parameter.

Required/Optional

This function is optional.

Table 9 clip_min

Description

Lower bound for the activation quantization algorithm

Type

float

Value

clip_min<0

Find the minimum min based on the distribution of the activation values at different layers. The recommended value range is [0.3 x min, 1.7 x min].

Command-Line Options

If this parameter is included, the lower bound of the clipping-based activation quantization algorithm is fixed. If this parameter is not included, the lower bound is learned using the IFMR algorithm.

Recommended Value

Do not include this parameter.

Required/Optional

This function is optional.

Table 10 dst_type

Description

Quantization bit width select

Type

string

Value

Currently, only INT8 (default) is supported.

Command-Line Options

Selects the quantization bit width during quantization.

Recommended Value

-

Required/Optional

This function is optional.