Simplified Configuration File for Auto Channel Pruning Search

The basic_info.proto file describes configurations for auto channel pruning search. Find the file in /amct_pytorch/proto/basic_info.proto under the AMCT installation directory.

Message

Required/Optional

Type

Field

Description

AutoMixedPrecisionConfig

-

-

-

Simplified configuration for AMCT automatic mixed-precision search. This feature is not supported in the current version.

Optional

float

compress_ratio

Compression ratio. The computation amount of all quantizable layers is used as a reference compression multiple.

Repeated

QuantBitLimit

quant_bit_limit

Quantization bit width search range of specified layers.

Optional

string

ptq_cfg

Simplified PTQ configuration file, which is used to obtain the quantization factors under the quantized data types of INT4 and INT8 during calibration.

If this parameter is not set, the default PTQ configuration is used.

Optional

int64

test_iteration

Number of batches to dump. The dump data is used to measure the quantization impact and computation amount. The data size should be large enough to be representative.

Optional

string

override_qat_cfg

Simplified QAT configuration file. The output of automatic mixed-precision search will overwrite the bit width of involved layers, and other parameters remain unchanged.

If this parameter is not set, the simplified QAT configuration file (.proto) is used to generate a .cfg configuration file with quantized data type information.

AutoChannelPruneConfig

-

-

-

Simplified configuration for AMCT auto channel pruning search

Required

float

compress_ratio

Compression ratio. The computation amount of all quantizable layers is used as a reference compression multiple.

Optional

bool

ascend_optimized

Whether to perform Ascend affinity optimization. If the pruned model needs to be deployed on the AI processor, you are advised to set this parameter to true.

Optional

float

max_prune_ratio

Maximum sparsity ratio of a single layer. The default value is 1.

Optional

int64

test_iteration

Batch number of the input test data.

Optional

string

override_prune_cfg

Simplified configuration file for channel pruning set by the user. It can contain only the skip and override configurations. The configured layers use the specified configuration and will not be rewritten by the auto channel pruning search APIs.

QuantBitLimit

-

-

-

Quantization bit width search range of specified layers.

Optional

string

layer_name

Layer name.

Repeated

DataType

data_range

Quantization bit width range.

DataType

-

-

-

Quantization bit width range, which is of the enumeration type. The current version supports only INT8 quantization.

-

-

FLOAT

Float. Not quantized.

-

-

INT8

INT8 quantization.

-

-

INT4

INT4 quantization.

The following is an example of the simplified configuration file (amc.cfg) for auto channel pruning:

compress_ratio: 1.5
ascend_optimized: true
max_prune_ratio: 0.8
test_iteration: 1
override_prune_cfg: 'your/path/to/override_channel_prune.cfg'