蒸馏简易配置文件【免费下载链接】amctAMCT是CANN提供的昇腾AI处理器亲和的模型压缩工具仓。项目地址: https://gitcode.com/cann/amctdistill_config_pytorch.proto文件参数说明如表1所示该文件所在目录为AMCT安装目录/amct_pytorch/proto/distill_config_pytorch.proto。表 1distill_config_pytorch.proto参数说明消息是否必填类型字段说明AMCTDistillConfig---AMCT蒸馏的简易配置。optionaluint32batch_num蒸馏batch数量用于ifmr积累数据计算量化因子。optionaluint32group_size蒸馏block中最小蒸馏单元个数。optionalbooldata_dumpteacher网络block输入输出dump开关。repeatedDistillGroupdistill_group用户自定义蒸馏结构。optionalDistillDataQuantConfigdistill_data_quant_config蒸馏数据量化配置参数。optionalDistillWeightQuantConfigdistill_weight_quant_config蒸馏权重量化配置参数。repeatedDistillOverrideLayerdistill_override_layers重写某一层的量化配置。repeatedDistillOverrideLayerTypedistill_override_layer_types重写某一类型层的量化配置。repeatedstringquant_skip_layers不需要量化的层仍然做蒸馏。repeatedstringquant_skip_layer_types不需要量化的算子类型仍然需要做蒸馏。DistillGroup---用户自定义蒸馏结构。蒸馏结构中仅支持torch.nn.Module类型的算子。requiredstringstart_layer_name用户自定义蒸馏结构起始层。requiredstringend_layer_name用户自定义蒸馏结构结束层。DistillDataQuantConfig---蒸馏数据量化配置。-ActULQquantizeulq_quantize数据量化的算法目前仅支持ulq。ActULQquantize---ULQ数据量化算法配置。算法介绍请参见ULQ数据量化算法。optionalClipMaxMinclip_max_min初始化的上下限值如果不配置默认用ifmr进行初始化。optionalboolfixed_min是否下限不学习且固定为0。默认ReLu后为true其他为false。optionalDataTypedst_type用以选择INT8或INT4量化位宽默认为INT8。当前版本仅支持INT8量化。ClipMaxMin---初始上下限。requiredfloatclip_max初始上限值。requiredfloatclip_min初始下限值。DistillWeightQuantConfig---蒸馏权重量化配置。-ARQDistillarq_distillARQ权重量化算法。-WtsULQDistillulq_distillULQ权重量化算法。ARQDistill---ARQ权重量化算法配置。算法介绍请参见ARQ权重量化算法。optionalDataTypedst_type用以选择INT8或INT4量化位宽默认为INT8。当前版本仅支持INT8量化。optionalboolchannel_wise是否做channel wise的arq。WtsULQDistill---ULQ权重量化算法配置。算法介绍请参见ULQ数据量化算法。optionalDataTypedst_type用以选择INT8或INT4量化位宽默认为INT8。当前版本仅支持INT8量化。optionalboolchannel_wise是否做channel wise的ulq。DistillOverrideLayer---重写的层配置。requiredstringlayer_name层名。optionalDistillDataQuantConfigdistill_data_quant_config重写的数据层量化参数。optionalDistillWeightQuantConfigdistill_weight_quant_config重写的权重层量化参数。DistillOverrideLayerType---重写的层类型配置。requiredstringlayer_type层类型。optionalDistillDataQuantConfigdistill_data_quant_config重写的数据层量化参数。optionalDistillWeightQuantConfigdistill_weight_quant_config重写的权重层量化参数。基于该文件构造的蒸馏简易配置文件quant.cfg样例如下所示batch_num: 1 group_size: 1 data_dump: true distill_group: { start_layer_name: layer1 end_layer_name: layer2 } distill_data_quant_config: { ulq_quantize: { clip_max_min: { clip_max: 6.0 clip_min: -6.0 } fixed_min: true dst_type: INT8 } } distill_weight_quant_config: { arq_distill: { channel_wise: true dst_type: INT8 } } quant_skip_layers: layer3 quant_skip_layer_types: type1 distill_override_layers : { layer_name: layer4 distill_data_quant_config: { ulq_quantize: { clip_max_min: { clip_max: 3.0 clip_min: -3.0 } fixed_min: true dst_type: INT8 } } distill_weight_quant_config: { arq_distill: { channel_wise: false dst_type: INT8 } } } distill_override_layer_types : { layer_type: type2 distill_data_quant_config: { ulq_quantize: { clip_max_min: { clip_max: 3.0 clip_min: -3.0 } fixed_min: true dst_type: INT8 } } distill_weight_quant_config: { ulq_distill: { channel_wise: false dst_type: INT8 } } }【免费下载链接】amctAMCT是CANN提供的昇腾AI处理器亲和的模型压缩工具仓。项目地址: https://gitcode.com/cann/amct创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考