基于mindspore的权重量化8bit,最终模型大小和float16大小一样

采用下面的固定比特量化的方式得到的量化模型大小和fp16精度一样大,推理效率也一样,没有int8量化的效果,去掉--optimize=ascend_oriented后大小符合预期,但推理报错
转换命令 ./converter_lite --fmk=MINDIR --saveType=MINDIR --modelFile=model.mindir --outputFile=model --optimize=ascend_oriented
量化参数
[common_quant_param]
quant_type=WEIGHT_QUANT
# Weight quantization supports the number of bits [0,16]. Set to 0 is mixed bit quantization, otherwise it is fixed bit quantization
bit_num=8
# Layers with size of weights exceeds threshold `min_quant_weight_size` will be quantized.
min_quant_weight_size=0
# Layers with channel size of weights exceeds threshold `min_quant_weight_channel` will be quantized.
min_quant_weight_channel=16

用户您好,已经收到上述问题,会尽快分析答复,请耐心等待下~

当前Ascend后端的量化支持不是特别的完善,当用户配置–optimize=ascend_oriented时候,表示使用的是ascend的推理,所以量化功能不是很完善;

建议通过torch或者onnxruntime进行量化,导出量化的onnx模型,然后通过MindSpore Lite离线转换工具进行转换,然后在ascend的硬件上部署推理;

最近MindSpore Lite代码仓提供了一个有关A8W8的量化skill,可以参考这个pr: AtomGit | GitCode - 全球开发者的开源社区,开源代码托管平台

此话题已在最后回复的 60 分钟后被自动关闭。不再允许新回复。