简易量化配置文件说明
calibration_config.proto文件参数说明如表4-31所示。
消息 |
是否必填 |
类型 |
字段 |
说明 |
---|---|---|---|---|
AMCTConfig |
- |
- |
- |
昇腾模型压缩工具的简易量化配置。 |
optional |
uint32 |
batch_num |
量化使用的batch数量。 |
|
optional |
bool |
activation_offset |
数据量化是否带offset。 |
|
repeated |
string |
skip_layers |
不需要量化层的层名。 |
|
repeated |
string |
skip_layer_types |
不需要量化的层类型。 |
|
optional |
CalibrationConfig |
common_config |
通用的量化配置,若某层未被override_layer_types或者override_layer_configs重写,则使用该配置。 |
|
repeated |
OverrideLayerType |
override_layer_types |
重写某一类型层的量化配置。 |
|
repeated |
OverrideLayer |
override_layer_configs |
重写某一层的量化配置。 |
|
optional |
bool |
do_fusion |
是否开启bn融合功能,默认为true,表示开启该功能。 |
|
repeated |
string |
skip_fusion_layers |
跳过bn融合的层,配置之后这些层不会进行bn融合。 |
|
OverrideLayerType |
required |
string |
layer_type |
支持量化的层类型的名字。 |
required |
CalibrationConfig |
calibration_config |
重置的量化配置。 |
|
OverrideLayer |
- |
- |
- |
重置某层量化配置。 |
required |
string |
layer_name |
被重置层的层名。 |
|
required |
CalibrationConfig |
calibration_config |
重置的量化配置。 |
|
CalibrationConfig |
- |
- |
- |
Calibration量化的配置。 |
- |
ARQuantize |
arq_quantize |
权重量化算法配置。 arq_quantize:ARQ量化算法配置。 |
|
- |
FMRQuantize |
ifmr_quantize |
数据量化算法配置。 ifmr_quantize:IFMR量化算法配置。 |
|
ARQuantize |
- |
- |
- |
ARQ量化算法配置。 |
optional |
bool |
channel_wise |
是否对每个channel采用不同的量化因子。 |
|
FMRQuantize |
- |
- |
- |
FMR量化算法配置。 |
optional |
float |
search_range_start |
量化因子搜索范围左边界。 |
|
optional |
float |
search_range_end |
量化因子搜索范围右边界。 |
|
optional |
float |
search_step |
量化因子搜索步长。 |
|
optional |
float |
max_percentile |
最大值搜索位置。 |
|
optional |
float |
min_percentile |
最小值搜索位置。 |
# global quantize parameter batch_num : 2 activation_offset : true skip_layers : "conv_1" skip_layer_types:"Conv2D" do_fusion: true skip_fusion_layers : "conv_1" common_config : { arq_quantize : { channel_wise : true } ifmr_quantize : { search_range_start : 0.7 search_range_end : 1.3 search_step : 0.01 max_percentile : 0.999999 min_percentile : 0.999999 } } override_layer_types : { layer_type : "MatMul" calibration_config : { arq_quantize : { channel_wise : false } ifmr_quantize : { search_range_start : 0.8 search_range_end : 1.2 search_step : 0.02 max_percentile : 0.999999 min_percentile : 0.999999 } } } override_layer_configs : { layer_name : "conv_2" calibration_config : { arq_quantize : { channel_wise : true } ifmr_quantize : { search_range_start : 0.8 search_range_end : 1.2 search_step : 0.02 max_percentile : 0.999999 min_percentile : 0.999999 } } }