精度比对
前提条件
完成精度数据采集,得到NPU和GPU环境的精度数据。
执行比对
- 将GPU环境下dump的精度数据拷贝至NPU环境。
- 创建比对配置文件compare.json,文件内容示例如下:
{ "npu_path": "./npu/dump_data/step0/rank/dump.json", "bench_path": "./gpu/dump_data/step0/rank/dump.json", "stack_path": "./npu/dump_data/step0/rank/stack.json", "is_print_compare_log": true }
- 执行比对,命令如下:
msprobe -f pytorch compare -i ./compare.json -o ./compare_result/accuracy_compare -s
出现如下打印说明比对成功:... Compare result is /xxx/compare_result/accuracy_compare/compare_result_{timestamp}.xlsx ... The advisor summary is saved in: /xxx/compare_result/accuracy_compare/advisor_{timestamp}.txt ************************************************************************************ * msprobe compare ends successfully. * ************************************************************************************
- 比对结果文件分析。
compare会在./compare_result/accuracy_compare生成两个文件,分别如下:
- advisor_{timestamp}.txt:文件中给出了可能存在精度问题的API的专家建议。
- compare_result_{timestamp}.xlsx:文件列出了所有执行精度比对的API详细信息和比对结果,可通过颜色标记、比对结果(Result)、计算精度达标情况(Accuracy Reached or Not)、错误信息提示(Err_Message)定位可疑算子,但鉴于每种指标都有对应的判定标准,还需要结合实际情况进行判断。示例如下:图1 比对结果
父主题: 模型精度调试