mindstudio-probe 1.0.4__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mindstudio_probe-1.0.4.dist-info → mindstudio_probe-1.1.1.dist-info}/METADATA +5 -5
- mindstudio_probe-1.1.1.dist-info/RECORD +341 -0
- {mindstudio_probe-1.0.4.dist-info → mindstudio_probe-1.1.1.dist-info}/WHEEL +1 -1
- {mindstudio_probe-1.0.4.dist-info → mindstudio_probe-1.1.1.dist-info}/entry_points.txt +0 -1
- msprobe/README.md +84 -18
- msprobe/__init__.py +16 -1
- msprobe/config.json +1 -5
- msprobe/core/advisor/advisor.py +16 -11
- msprobe/core/advisor/advisor_const.py +6 -7
- msprobe/core/advisor/advisor_result.py +12 -12
- msprobe/core/common/const.py +164 -3
- msprobe/core/common/exceptions.py +26 -4
- msprobe/core/common/file_utils.py +196 -27
- msprobe/core/common/inplace_op_checker.py +53 -0
- msprobe/core/common/inplace_ops.yaml +251 -0
- msprobe/core/common/log.py +46 -18
- msprobe/core/common/utils.py +308 -209
- msprobe/core/common_config.py +60 -38
- msprobe/core/compare/acc_compare.py +332 -94
- msprobe/core/compare/check.py +104 -22
- msprobe/core/compare/compare_cli.py +42 -5
- msprobe/core/compare/highlight.py +162 -57
- msprobe/core/compare/layer_mapping/__init__.py +19 -0
- msprobe/core/compare/layer_mapping/data_scope_parser.py +235 -0
- msprobe/core/compare/layer_mapping/layer_mapping.py +242 -0
- msprobe/core/compare/layer_mapping/postprocess_pass.py +94 -0
- msprobe/core/compare/multiprocessing_compute.py +33 -8
- msprobe/core/compare/npy_compare.py +73 -29
- msprobe/core/compare/utils.py +306 -247
- msprobe/core/data_dump/data_collector.py +44 -43
- msprobe/core/data_dump/data_processor/base.py +88 -35
- msprobe/core/data_dump/data_processor/factory.py +20 -3
- msprobe/core/data_dump/data_processor/mindspore_processor.py +14 -8
- msprobe/core/data_dump/data_processor/pytorch_processor.py +180 -66
- msprobe/core/data_dump/json_writer.py +63 -42
- msprobe/core/data_dump/scope.py +143 -48
- msprobe/core/grad_probe/constant.py +31 -13
- msprobe/core/grad_probe/grad_compare.py +20 -4
- msprobe/core/grad_probe/utils.py +44 -3
- msprobe/core/overflow_check/abnormal_scene.py +185 -0
- msprobe/core/overflow_check/api_info.py +55 -0
- msprobe/core/overflow_check/checker.py +138 -0
- msprobe/core/overflow_check/filter.py +157 -0
- msprobe/core/overflow_check/ignore_rules.yaml +55 -0
- msprobe/core/overflow_check/level.py +22 -0
- msprobe/core/overflow_check/utils.py +28 -0
- msprobe/docs/01.installation.md +29 -9
- msprobe/docs/02.config_introduction.md +83 -84
- msprobe/docs/03.config_examples.md +3 -20
- msprobe/docs/04.kernel_dump_PyTorch.md +73 -0
- msprobe/docs/05.data_dump_PyTorch.md +143 -13
- msprobe/docs/06.data_dump_MindSpore.md +197 -88
- msprobe/docs/07.accuracy_checker_PyTorch.md +69 -46
- msprobe/docs/08.accuracy_checker_online_PyTorch.md +52 -17
- msprobe/docs/09.accuracy_checker_MindSpore.md +51 -15
- msprobe/docs/10.accuracy_compare_PyTorch.md +187 -99
- msprobe/docs/11.accuracy_compare_MindSpore.md +253 -31
- msprobe/docs/12.overflow_check_PyTorch.md +1 -1
- msprobe/docs/13.overflow_check_MindSpore.md +6 -6
- msprobe/docs/15.free_benchmarking_PyTorch.md +60 -55
- msprobe/docs/16.free_benchmarking_MindSpore.md +159 -0
- msprobe/docs/17.grad_probe.md +19 -22
- msprobe/docs/18.online_dispatch.md +89 -0
- msprobe/docs/19.monitor.md +468 -0
- msprobe/docs/20.monitor_performance_baseline.md +52 -0
- msprobe/docs/21.visualization_PyTorch.md +386 -0
- msprobe/docs/22.visualization_MindSpore.md +384 -0
- msprobe/docs/23.tool_function_introduction.md +28 -0
- msprobe/docs/{FAQ_PyTorch.md → FAQ.md} +25 -10
- msprobe/docs/data_dump_Mindspore/dynamic_graph_quick_start_example.md +211 -0
- msprobe/docs/img/compare_result.png +0 -0
- msprobe/docs/img/monitor/cpu_info.png +0 -0
- msprobe/docs/img/ms_dump.png +0 -0
- msprobe/docs/img/ms_layer.png +0 -0
- msprobe/docs/img/pt_dump.png +0 -0
- msprobe/mindspore/__init__.py +16 -0
- msprobe/mindspore/api_accuracy_checker/api_accuracy_checker.py +130 -138
- msprobe/mindspore/api_accuracy_checker/api_info.py +27 -5
- msprobe/mindspore/api_accuracy_checker/api_runner.py +43 -18
- msprobe/mindspore/api_accuracy_checker/base_compare_algorithm.py +21 -7
- msprobe/mindspore/api_accuracy_checker/checker_support_api.yaml +77 -0
- msprobe/mindspore/api_accuracy_checker/cmd_parser.py +63 -1
- msprobe/mindspore/api_accuracy_checker/compute_element.py +59 -24
- msprobe/mindspore/api_accuracy_checker/data_manager.py +264 -0
- msprobe/mindspore/api_accuracy_checker/main.py +27 -3
- msprobe/mindspore/api_accuracy_checker/multi_api_accuracy_checker.py +206 -0
- msprobe/mindspore/api_accuracy_checker/multi_data_manager.py +58 -0
- msprobe/mindspore/api_accuracy_checker/type_mapping.py +22 -5
- msprobe/mindspore/api_accuracy_checker/utils.py +34 -17
- msprobe/mindspore/cell_processor.py +58 -13
- msprobe/mindspore/common/const.py +35 -13
- msprobe/mindspore/common/log.py +5 -9
- msprobe/mindspore/common/utils.py +60 -5
- msprobe/mindspore/compare/distributed_compare.py +15 -28
- msprobe/mindspore/compare/ms_compare.py +319 -158
- msprobe/mindspore/compare/ms_graph_compare.py +99 -49
- msprobe/mindspore/debugger/debugger_config.py +20 -14
- msprobe/mindspore/debugger/precision_debugger.py +43 -13
- msprobe/mindspore/dump/dump_tool_factory.py +18 -1
- msprobe/mindspore/dump/hook_cell/api_registry.py +23 -3
- msprobe/mindspore/dump/hook_cell/primitive_hooks.py +203 -0
- msprobe/mindspore/dump/hook_cell/support_wrap_ops.yaml +107 -10
- msprobe/mindspore/dump/hook_cell/wrap_api.py +21 -13
- msprobe/mindspore/dump/jit_dump.py +56 -20
- msprobe/mindspore/dump/kernel_graph_dump.py +19 -5
- msprobe/mindspore/dump/kernel_kbyk_dump.py +19 -6
- msprobe/mindspore/dym_loader/hook_dynamic_loader.cc +140 -0
- msprobe/mindspore/dym_loader/hook_dynamic_loader.h +53 -0
- msprobe/mindspore/free_benchmark/api_pynative_self_check.py +162 -41
- msprobe/mindspore/free_benchmark/common/config.py +15 -0
- msprobe/mindspore/free_benchmark/common/handler_params.py +15 -1
- msprobe/mindspore/free_benchmark/common/utils.py +37 -8
- msprobe/mindspore/free_benchmark/data/support_wrap_ops.yaml +0 -204
- msprobe/mindspore/free_benchmark/handler/base_handler.py +20 -5
- msprobe/mindspore/free_benchmark/handler/check_handler.py +21 -7
- msprobe/mindspore/free_benchmark/handler/fix_handler.py +18 -3
- msprobe/mindspore/free_benchmark/handler/handler_factory.py +21 -6
- msprobe/mindspore/free_benchmark/perturbation/add_noise.py +23 -8
- msprobe/mindspore/free_benchmark/perturbation/base_perturbation.py +29 -5
- msprobe/mindspore/free_benchmark/perturbation/bit_noise.py +25 -10
- msprobe/mindspore/free_benchmark/perturbation/exchange_value.py +45 -19
- msprobe/mindspore/free_benchmark/perturbation/improve_precision.py +29 -8
- msprobe/mindspore/free_benchmark/perturbation/no_change.py +16 -1
- msprobe/mindspore/free_benchmark/perturbation/perturbation_factory.py +22 -7
- msprobe/mindspore/free_benchmark/self_check_tool_factory.py +17 -2
- msprobe/mindspore/grad_probe/global_context.py +44 -14
- msprobe/mindspore/grad_probe/grad_analyzer.py +27 -13
- msprobe/mindspore/grad_probe/grad_monitor.py +16 -1
- msprobe/mindspore/grad_probe/grad_stat_csv.py +33 -5
- msprobe/mindspore/grad_probe/hook.py +24 -10
- msprobe/mindspore/grad_probe/utils.py +18 -5
- msprobe/mindspore/ms_config.py +22 -15
- msprobe/mindspore/overflow_check/kernel_graph_overflow_check.py +20 -6
- msprobe/mindspore/overflow_check/overflow_check_tool_factory.py +15 -0
- msprobe/mindspore/runtime.py +15 -0
- msprobe/mindspore/service.py +75 -150
- msprobe/mindspore/task_handler_factory.py +15 -0
- msprobe/msprobe.py +24 -7
- msprobe/pytorch/__init__.py +23 -3
- msprobe/pytorch/api_accuracy_checker/common/config.py +81 -2
- msprobe/pytorch/api_accuracy_checker/common/utils.py +53 -21
- msprobe/pytorch/api_accuracy_checker/compare/algorithm.py +19 -2
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_compare.py +50 -25
- msprobe/pytorch/api_accuracy_checker/compare/compare.py +51 -21
- msprobe/pytorch/api_accuracy_checker/compare/compare_column.py +23 -6
- msprobe/pytorch/api_accuracy_checker/compare/compare_utils.py +28 -8
- msprobe/pytorch/api_accuracy_checker/config.yaml +1 -1
- msprobe/pytorch/api_accuracy_checker/generate_op_script/config_op.json +9 -0
- msprobe/pytorch/api_accuracy_checker/generate_op_script/op_generator.py +454 -0
- msprobe/pytorch/api_accuracy_checker/generate_op_script/operator_replication.template +365 -0
- msprobe/pytorch/api_accuracy_checker/run_ut/data_generate.py +73 -33
- msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py +44 -18
- msprobe/pytorch/api_accuracy_checker/run_ut/run_overflow_check.py +32 -11
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut.py +122 -172
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut_utils.py +158 -4
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/attl.py +30 -24
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/client.py +68 -31
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/device_dispatch.py +27 -4
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/dump_dispatch.py +115 -0
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/server.py +26 -9
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/torch_ops_config.yaml +63 -0
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/utils.py +44 -0
- msprobe/pytorch/bench_functions/__init__.py +18 -3
- msprobe/pytorch/bench_functions/apply_adam_w.py +15 -0
- msprobe/pytorch/bench_functions/confusion_transpose.py +20 -1
- msprobe/pytorch/bench_functions/fast_gelu.py +15 -0
- msprobe/pytorch/bench_functions/layer_norm_eval.py +15 -0
- msprobe/pytorch/bench_functions/linear.py +15 -0
- msprobe/pytorch/bench_functions/matmul_backward.py +33 -6
- msprobe/pytorch/bench_functions/npu_fusion_attention.py +280 -157
- msprobe/pytorch/bench_functions/rms_norm.py +15 -0
- msprobe/pytorch/bench_functions/rotary_mul.py +32 -9
- msprobe/pytorch/bench_functions/scaled_mask_softmax.py +15 -0
- msprobe/pytorch/bench_functions/swiglu.py +29 -6
- msprobe/pytorch/common/__init__.py +15 -0
- msprobe/pytorch/common/log.py +18 -6
- msprobe/pytorch/common/parse_json.py +31 -16
- msprobe/pytorch/common/utils.py +96 -40
- msprobe/pytorch/compare/distributed_compare.py +13 -14
- msprobe/pytorch/compare/match.py +15 -0
- msprobe/pytorch/compare/pt_compare.py +44 -10
- msprobe/pytorch/debugger/debugger_config.py +69 -52
- msprobe/pytorch/debugger/precision_debugger.py +72 -24
- msprobe/pytorch/dump/kernel_dump/kernel_config.py +33 -0
- msprobe/pytorch/free_benchmark/__init__.py +20 -5
- msprobe/pytorch/free_benchmark/common/constant.py +15 -0
- msprobe/pytorch/free_benchmark/common/counter.py +15 -0
- msprobe/pytorch/free_benchmark/common/enums.py +43 -0
- msprobe/pytorch/free_benchmark/common/params.py +23 -1
- msprobe/pytorch/free_benchmark/common/utils.py +43 -5
- msprobe/pytorch/free_benchmark/compare/grad_saver.py +47 -9
- msprobe/pytorch/free_benchmark/compare/single_benchmark.py +17 -0
- msprobe/pytorch/free_benchmark/main.py +19 -4
- msprobe/pytorch/free_benchmark/perturbed_layers/base_layer.py +15 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/layer_factory.py +19 -4
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/add_noise.py +18 -1
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/bit_noise.py +21 -4
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/change_value.py +28 -2
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/improve_precision.py +19 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/no_change.py +15 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/npu_base_layser.py +15 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/run_cpu.py +15 -0
- msprobe/pytorch/free_benchmark/result_handlers/base_handler.py +65 -16
- msprobe/pytorch/free_benchmark/result_handlers/check_handler.py +15 -0
- msprobe/pytorch/free_benchmark/result_handlers/fix_handler.py +21 -5
- msprobe/pytorch/free_benchmark/result_handlers/handler_factory.py +15 -0
- msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py +19 -4
- msprobe/pytorch/function_factory.py +17 -2
- msprobe/pytorch/functional/module_dump.py +84 -0
- msprobe/pytorch/grad_probe/grad_monitor.py +23 -6
- msprobe/pytorch/grad_probe/grad_stat_csv.py +40 -10
- msprobe/pytorch/hook_module/__init__.py +16 -1
- msprobe/pytorch/hook_module/api_registry.py +13 -8
- msprobe/pytorch/hook_module/hook_module.py +17 -19
- msprobe/pytorch/hook_module/support_wrap_ops.yaml +1 -0
- msprobe/pytorch/hook_module/utils.py +4 -6
- msprobe/pytorch/hook_module/wrap_aten.py +12 -11
- msprobe/pytorch/hook_module/wrap_distributed.py +6 -7
- msprobe/pytorch/hook_module/wrap_functional.py +21 -20
- msprobe/pytorch/hook_module/wrap_npu_custom.py +9 -17
- msprobe/pytorch/hook_module/wrap_tensor.py +4 -6
- msprobe/pytorch/hook_module/wrap_torch.py +4 -6
- msprobe/pytorch/hook_module/wrap_vf.py +4 -6
- msprobe/pytorch/module_processer.py +18 -6
- msprobe/pytorch/monitor/anomaly_analyse.py +201 -0
- msprobe/pytorch/monitor/anomaly_detect.py +340 -0
- msprobe/pytorch/monitor/distributed/distributed_ops.yaml +19 -0
- msprobe/pytorch/monitor/distributed/stack_blacklist.yaml +5 -0
- msprobe/pytorch/monitor/distributed/wrap_distributed.py +272 -0
- msprobe/pytorch/monitor/features.py +108 -0
- msprobe/pytorch/monitor/module_hook.py +870 -0
- msprobe/pytorch/monitor/module_metric.py +193 -0
- msprobe/pytorch/monitor/module_spec_verifier.py +93 -0
- msprobe/pytorch/monitor/optimizer_collect.py +295 -0
- msprobe/pytorch/monitor/unittest/__init__.py +0 -0
- msprobe/pytorch/monitor/unittest/test_monitor.py +145 -0
- msprobe/pytorch/monitor/utils.py +250 -0
- msprobe/pytorch/monitor/visualizer.py +59 -0
- msprobe/pytorch/online_dispatch/__init__.py +2 -3
- msprobe/pytorch/online_dispatch/compare.py +38 -48
- msprobe/pytorch/online_dispatch/dispatch.py +50 -25
- msprobe/pytorch/online_dispatch/dump_compare.py +21 -9
- msprobe/pytorch/online_dispatch/single_compare.py +60 -39
- msprobe/pytorch/online_dispatch/torch_ops_config.yaml +9 -1
- msprobe/pytorch/online_dispatch/utils.py +48 -23
- msprobe/pytorch/parse.py +15 -0
- msprobe/pytorch/parse_tool/cli.py +5 -6
- msprobe/pytorch/parse_tool/lib/compare.py +19 -26
- msprobe/pytorch/parse_tool/lib/config.py +1 -1
- msprobe/pytorch/parse_tool/lib/parse_tool.py +4 -2
- msprobe/pytorch/parse_tool/lib/utils.py +40 -55
- msprobe/pytorch/parse_tool/lib/visualization.py +3 -1
- msprobe/pytorch/pt_config.py +192 -40
- msprobe/pytorch/service.py +110 -35
- msprobe/visualization/__init__.py +14 -0
- msprobe/visualization/builder/__init__.py +14 -0
- msprobe/visualization/builder/graph_builder.py +165 -0
- msprobe/visualization/builder/msprobe_adapter.py +205 -0
- msprobe/visualization/compare/__init__.py +14 -0
- msprobe/visualization/compare/graph_comparator.py +130 -0
- msprobe/visualization/compare/mode_adapter.py +211 -0
- msprobe/visualization/graph/__init__.py +14 -0
- msprobe/visualization/graph/base_node.py +124 -0
- msprobe/visualization/graph/graph.py +200 -0
- msprobe/visualization/graph/node_colors.py +95 -0
- msprobe/visualization/graph/node_op.py +39 -0
- msprobe/visualization/graph_service.py +214 -0
- msprobe/visualization/utils.py +232 -0
- mindstudio_probe-1.0.4.dist-info/RECORD +0 -276
- msprobe/docs/04.acl_config_examples.md +0 -76
- msprobe/mindspore/free_benchmark/decorator/dec_forward.py +0 -43
- msprobe/mindspore/free_benchmark/decorator/decorator_factory.py +0 -107
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/ssl_config.py +0 -10
- msprobe/pytorch/functional/dump_module.py +0 -39
- {mindstudio_probe-1.0.4.dist-info → mindstudio_probe-1.1.1.dist-info}/LICENSE +0 -0
- {mindstudio_probe-1.0.4.dist-info → mindstudio_probe-1.1.1.dist-info}/top_level.txt +0 -0
- /msprobe/{mindspore/free_benchmark/decorator → pytorch/monitor}/__init__.py +0 -0
- /msprobe/pytorch/{functional/data_processor.py → monitor/distributed/__init__.py} +0 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
- 同一模型,从 CPU 或 GPU 移植到 NPU 中存在精度下降问题,对比 NPU 芯片中的 API 计算数值与 CPU 或 GPU 芯片中的 API 计算数值,进行问题定位。
|
|
16
16
|
- 同一模型,进行迭代(模型、框架版本升级或设备硬件升级)时存在的精度下降问题,对比相同模型在迭代前后版本的 API 计算数值,进行问题定位。
|
|
17
|
+
- 以上两个场景下,当存在无法自动匹配的API和模块时,则通过用户手动指定可以比对的API或模块来自定义映射关系,进行比对。
|
|
17
18
|
|
|
18
19
|
**注意事项**:
|
|
19
20
|
|
|
@@ -21,46 +22,81 @@
|
|
|
21
22
|
- NPU 与 CPU 或 GPU 的计算结果误差可能会随着模型的执行不断累积,最终会出现同一个 API 因为输入的数据差异较大而无法比对的情况。
|
|
22
23
|
- CPU 或 GPU 与 NPU 中两个相同的 API 会因为调用次数不同导致无法比对或比对到错误的 API,不影响整体运行,该 API 忽略。
|
|
23
24
|
|
|
24
|
-
**API匹配条件**:
|
|
25
|
+
**API 匹配条件**:
|
|
25
26
|
|
|
26
|
-
进行精度比对时,需要判断CPU或GPU的API与NPU的API
|
|
27
|
+
进行精度比对时,需要判断 CPU 或 GPU 的 API 与 NPU 的 API 是否可以比对,须满足以下匹配条件:
|
|
27
28
|
|
|
28
|
-
- 两个API的名称相同,API命名规则:`{api_type}.{api_name}.{api调用次数}.{正反向}.{输入输出}.index`,如:Functional.conv2d.1.backward.input.0。
|
|
29
|
-
- 两个API
|
|
29
|
+
- 两个 API 的名称相同,API 命名规则:`{api_type}.{api_name}.{api调用次数}.{正反向}.{输入输出}.{index}`,如:Functional.conv2d.1.backward.input.0。
|
|
30
|
+
- 两个 API 输入输出的 Tensor 数量相同且各个 Tensor 的 Shape 相同。
|
|
30
31
|
|
|
31
|
-
通常满足以上两个条件,工具就认为是同一个API,成功进行API
|
|
32
|
+
通常满足以上两个条件,工具就认为是同一个 API,成功进行 API 的匹配,后续进行相应的计算。
|
|
32
33
|
|
|
33
34
|
## 2 精度比对操作指导
|
|
34
35
|
|
|
35
36
|
### 2.1 命令行方式
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
#### 2.1.1 比对命令说明
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
命令示例如下:
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
```shell
|
|
43
|
+
msprobe -f pytorch compare -i ./compare.json -o ./output -s
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**完整参数说明**:
|
|
47
|
+
|
|
48
|
+
| 参数名 | 说明 | 是否必选 |
|
|
49
|
+
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
50
|
+
| -i 或 --input_path | 指定[比对文件](#214-比对文件),str 类型。 | 是 |
|
|
51
|
+
| -o 或 --output_path | 配置比对结果文件存盘目录,str 类型,默认在当前目录创建output目录。文件名称基于时间戳自动生成,格式为:`compare_result_{timestamp}.xlsx`。 | 否 |
|
|
52
|
+
| -s 或 --stack_mode | 比对结果展示调用栈信息(NPU_Stack_Info)的开关,bool 类型。单卡场景开启时,需要使用[比对文件](#214-比对文件)的单卡场景配置stack_path指定stack.json文件,才能生成详细调用栈信息,否则在比对时会报错;多卡场景开启时,npu_dump目录下需要存在stack.json文件,才能生成详细调用栈信息,否则在比对时会报错。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
53
|
+
| -c 或 --compare_only | 仅比对开关,bool 类型。该参数默认未配置,会启用自动精度分析,工具自动针对比对结果进行分析,识别到第一个精度可能不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 `advisor_{timestamp}.txt` 文件)。通过配置该参数取消自动精度分析,仅输出比对结果表格。 | 否 |
|
|
54
|
+
| -f 或 --fuzzy_match | 模糊匹配,bool 类型。开启后,对于网络中同一层级且命名仅调用次数不同的 API,可匹配并进行比对。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
55
|
+
| -dm或--data_mapping | 自定义映射关系比对。需要指定自定义映射文件*.yaml。自定义映射文件的格式请参见[自定义映射文件](#215-自定义映射文件)。仅[API和模块无法自动匹配场景](#213-api和模块无法自动匹配场景)需要配置。仅支持逐卡比对,即使用[比对文件](#214-比对文件)的单卡场景示例。 | 否 |
|
|
56
|
+
|
|
57
|
+
#### 2.1.2 整网比对场景
|
|
58
|
+
|
|
59
|
+
整网比对场景是包含:CPU 或 GPU 与 NPU环境的 API 计算数值的整网数据比对;相同模型不同迭代版本的 API 计算数值的整网数据比对。
|
|
60
|
+
|
|
61
|
+
支持单卡和多卡,可同时比对多卡的 dump 数据。多机场景需要每个设备单独执行比对操作。
|
|
42
62
|
|
|
43
|
-
1.
|
|
63
|
+
1. 配置[config.json](../config.json)文件。
|
|
44
64
|
|
|
45
|
-
2.
|
|
65
|
+
2. 参见 [PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节完成 CPU 或 GPU 与 NPU 的精度数据 dump。
|
|
66
|
+
|
|
67
|
+
3. 创建[比对文件](#214-比对文件)。
|
|
68
|
+
|
|
69
|
+
4. 运行命令:
|
|
46
70
|
|
|
47
71
|
```shell
|
|
48
72
|
msprobe -f pytorch compare -i ./compare.json -o ./output -s
|
|
49
73
|
```
|
|
50
74
|
|
|
51
|
-
|
|
75
|
+
5. 查看比对结果,请参见 [3 精度比对结果分析](#3-精度比对结果分析)。
|
|
76
|
+
|
|
77
|
+
#### 2.1.3 API和模块无法自动匹配场景
|
|
78
|
+
|
|
79
|
+
当存在无法自动匹配的API和模块时,则用户可以通过提供自定义映射关系的配置文件来告知工具可匹配的API或模块,进行比对。
|
|
80
|
+
|
|
81
|
+
1. [config.json](../config.json)文件level配置为L0或L1、task配置为tensor或statistics并指定需要dump的API或模块名。
|
|
52
82
|
|
|
53
|
-
|
|
54
|
-
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
55
|
-
| -i 或 --input_path | 指定[比对文件](#211-比对文件)。 | 是 |
|
|
56
|
-
| -o 或 --output_path | 配置比对结果文件存盘目录。文件名称基于时间戳自动生成,格式为:`compare_result_{timestamp}.xlsx`。 | 是 |
|
|
57
|
-
| -s 或 --stack_mode | 配置 stack_mode 的开关。仅当[比对文件](#211-比对文件)配置 stack_path 需要开启。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
58
|
-
| -c 或 --compare_only | 仅比对开关。未配置默认关闭仅比对,使用自动精度分析,工具自动针对比对结果进行分析,识别到第一个精度不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 `advisor_{timestamp}.txt` 文件)。该参数默认未配置,使用自动精度分析,通过配置该参数开启仅比对,关闭自动精度分析,仅输出比对结果表格。 | 否 |
|
|
59
|
-
| -f 或 --fuzzy_match | 模糊匹配。开启后,对于网络中同一层级且命名仅调用次数不同的 API,可匹配并进行比对。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
83
|
+
2. 参见[PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节完成 CPU 或 GPU 与 NPU 的精度数据 dump。
|
|
60
84
|
|
|
61
|
-
3.
|
|
85
|
+
3. 创建[比对文件](#214-比对文件)(单卡场景示例)。
|
|
62
86
|
|
|
63
|
-
|
|
87
|
+
4. 运行命令:
|
|
88
|
+
|
|
89
|
+
```shell
|
|
90
|
+
msprobe -f pytorch compare -i ./compare.json -o ./output -s -dm data_mapping.yaml
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
data_mapping.yaml文件配置请参见[自定义映射文件](#215-自定义映射文件)。
|
|
94
|
+
|
|
95
|
+
该场景不支持-f模糊匹配。
|
|
96
|
+
|
|
97
|
+
5. 查看比对结果,请参见 [3 精度比对结果分析](#3-精度比对结果分析)。
|
|
98
|
+
|
|
99
|
+
#### 2.1.4 比对文件
|
|
64
100
|
|
|
65
101
|
以在当前目录创建 ./compare.json 为例。
|
|
66
102
|
|
|
@@ -87,42 +123,46 @@
|
|
|
87
123
|
|
|
88
124
|
**参数说明**:
|
|
89
125
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
126
|
+
| 参数名 | 说明 | 是否必选 |
|
|
127
|
+
| -------------------- | ------------------------------------------------------------ | ------------------ |
|
|
128
|
+
| npu_path | 配置 NPU 环境下的 dump.json 文件(单卡场景)或真实数据目录(多卡场景),str 类型。 | 是 |
|
|
129
|
+
| bench_path | 配置 CPU、GPU 或 NPU 环境下的 dump.json 文件(单卡场景)或真实数据目录(多卡场景),str 类型。 | 是 |
|
|
130
|
+
| stack_path | 配置 NPU dump 目录下的 stack.json 文件,str 类型。 | 单卡必选,多卡不选 |
|
|
131
|
+
| is_print_compare_log | 配置是否开启单个算子的日志打屏。可取值 true 或 false,默认为 true。关闭后则只输出常规日志,bool 类型。 | 否 |
|
|
96
132
|
|
|
97
|
-
|
|
133
|
+
#### 2.1.5 自定义映射文件
|
|
98
134
|
|
|
99
|
-
|
|
135
|
+
文件名格式:*.yaml,*为文件名,可自定义。
|
|
100
136
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
**函数原型**:
|
|
137
|
+
文件内容格式:
|
|
104
138
|
|
|
105
|
-
```
|
|
106
|
-
|
|
139
|
+
```yaml
|
|
140
|
+
# API
|
|
141
|
+
{api_type}.{api_name}.{API调用次数}.{前向反向}.{input/output}.{参数序号}: {api_type}.{api_name}.{API调用次数}.{前向反向}.{input/output}.{参数序号}
|
|
142
|
+
# 模块
|
|
143
|
+
{Module}.{module_name}.{前向反向}.{index}.{input/output}.{参数序号}: {Module}.{module_name}.{前向反向}.{index}.{input/output}.{参数序号}
|
|
107
144
|
```
|
|
108
145
|
|
|
109
|
-
|
|
146
|
+
冒号左侧和右侧分别为PyTorch框架不同版本或不同芯片环境的API的名称和module模块名称。
|
|
110
147
|
|
|
111
|
-
|
|
112
|
-
| -------------- | ------------------------------------------------------------ | -------- |
|
|
113
|
-
| npu_dump_dir | 配置 NPU 环境下的 dump 目录。str 类型。dump 数据目录须指定到 step 级。<br/>**配置示例**:'./npu_dump/step0'。 | 是 |
|
|
114
|
-
| bench_dump_dir | 配置 CPU、GPU 或 NPU 环境下的 dump 目录。str 类型。<br/>**配置示例**:'./gpu_dump/step0'。 | 是 |
|
|
115
|
-
| output_path | 配置比对结果文件存盘目录。需要预先创建 output_path 目录。str 类型。<br/>**配置示例**:'./output'。文件名称基于时间戳自动生成,格式为:`compare_result_rank{npu_ID}-rank{cpu/gpu/npu_ID}_{timestamp}.xlsx`。 | 是 |
|
|
116
|
-
| **kwargs | 支持 compare 的所有可选参数。 | 否 |
|
|
148
|
+
API和模块名称请从《[PyTorch 场景的精度数据采集](05.data_dump_PyTorch.md)》中的dump.json文件获取。
|
|
117
149
|
|
|
118
|
-
|
|
150
|
+
文件内容示例:
|
|
119
151
|
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
152
|
+
```yaml
|
|
153
|
+
# API
|
|
154
|
+
NPU.npu_fusion_attention.4.forward.input.0: NPU.npu_fusion_attention.4.forward.input.0
|
|
155
|
+
# 模块
|
|
156
|
+
Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.forward.0.input.0: Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.forward.0.input.0
|
|
123
157
|
```
|
|
124
158
|
|
|
125
|
-
|
|
159
|
+
API和模块名称在dump.json文件中的“data_name”字段展示,如下图红框处所示:
|
|
160
|
+
|
|
161
|
+

|
|
162
|
+
|
|
163
|
+
### 2.2 比对函数方式
|
|
164
|
+
|
|
165
|
+
#### 2.2.1 compare 函数
|
|
126
166
|
|
|
127
167
|
此函数将 CPU 或 GPU 与 NPU 的 dump 文件进行比对,仅支持单机单卡。
|
|
128
168
|
|
|
@@ -136,10 +176,10 @@ compare(input_param, output_path, stack_mode=False, auto_analyze=True, fuzzy_mat
|
|
|
136
176
|
|
|
137
177
|
| 参数名 | 说明 | 是否必选 |
|
|
138
178
|
| ------------ | ------------------------------------------------------------ | -------- |
|
|
139
|
-
| input_param | 配置 dump 数据文件及目录,dict 类型。配置参数包括:<br> "npu_json_path":指定 NPU dump 目录下的 dump.json 文件。<br/>**配置示例**:"npu_json_path": "./npu_dump/dump.json"。<br/> "bench_json_path":指定 CPU、GPU 或 NPU dump 目录下的 dump.json 文件。<br/>**配置示例**:"bench_json_path": "./bench_dump/dump.json"。<br/> "stack_json_path":指定 NPU dump 目录下的 stack.json 文件。<br/>**配置示例**:"stack_json_path": "./npu_dump/stack.json"。<br/> "is_print_compare_log"
|
|
179
|
+
| input_param | 配置 dump 数据文件及目录,dict 类型。配置参数包括:<br> "npu_json_path":指定 NPU dump 目录下的 dump.json 文件。<br/>**配置示例**:"npu_json_path": "./npu_dump/dump.json"。<br/> "bench_json_path":指定 CPU、GPU 或 NPU dump 目录下的 dump.json 文件。<br/>**配置示例**:"bench_json_path": "./bench_dump/dump.json"。<br/> "stack_json_path":指定 NPU dump 目录下的 stack.json 文件。<br/>**配置示例**:"stack_json_path": "./npu_dump/stack.json"。<br/> "is_print_compare_log":配置是否开启单个算子的日志打屏。<br/>**配置示例**:True 或 False。 | 是 |
|
|
140
180
|
| output_path | 配置比对结果文件存盘目录,str 类型。<br/>**配置示例**:'./output'。文件名称基于时间戳自动生成,格式为:`compare_result_{timestamp}.xlsx`。 | 是 |
|
|
141
181
|
| stack_mode | 配置 stack_mode 的开关,bool 类型。仅当配置 stack_json_path 时需要开启。<br/>**配置示例**:stack_mode=True,默认为 False。 | 否 |
|
|
142
|
-
| auto_analyze | 自动精度分析,bool
|
|
182
|
+
| auto_analyze | 自动精度分析,bool 类型。开启后工具自动针对比对结果进行分析,识别到第一个精度可能不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 advisor_{timestamp}.txt 文件)。<br/>**配置示例**:auto_analyze=False,默认为 True。 | 否 |
|
|
143
183
|
| fuzzy_match | 模糊匹配,bool 类型。开启后,对于网络中同一层级且命名仅调用次数不同的 API,可匹配并进行比对。<br/>**配置示例**:fuzzy_match=True,默认为 False。 | 否 |
|
|
144
184
|
|
|
145
185
|
**函数示例**:
|
|
@@ -157,89 +197,137 @@ input_param={
|
|
|
157
197
|
compare(input_param, output_path="./output", stack_mode=True)
|
|
158
198
|
```
|
|
159
199
|
|
|
160
|
-
#### 2.2.
|
|
200
|
+
#### 2.2.2 compare_distributed 函数
|
|
161
201
|
|
|
162
|
-
|
|
202
|
+
此函数将 CPU 或 GPU 与 NPU 的 dump 文件进行比对,支持单卡和多卡,可同时比对多卡的 dump 数据。多机场景需要每个设备单独执行比对操作。可自动检索和匹配对应卡和进程所 dump 的数据文件,再调用 compare 进行比对。单机单卡时与 compare 函数二选一。
|
|
163
203
|
|
|
164
|
-
|
|
204
|
+
**函数原型**:
|
|
165
205
|
|
|
166
|
-
|
|
206
|
+
```Python
|
|
207
|
+
compare_distributed(npu_dump_dir, bench_dump_dir, output_path, **kwargs)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**参数说明**:
|
|
211
|
+
|
|
212
|
+
| 参数名 | 说明 | 是否必选 |
|
|
213
|
+
| -------------- | ------------------------------------------------------------ | -------- |
|
|
214
|
+
| npu_dump_dir | 配置 NPU 环境下的 dump 目录。str 类型。dump 数据目录须指定到 step 级。<br/>**配置示例**:'./npu_dump/step0'。 | 是 |
|
|
215
|
+
| bench_dump_dir | 配置 CPU、GPU 或 NPU 环境下的 dump 目录。str 类型。<br/>**配置示例**:'./gpu_dump/step0'。 | 是 |
|
|
216
|
+
| output_path | 配置比对结果文件存盘目录。需要预先创建 output_path 目录。str 类型。<br/>**配置示例**:'./output'。文件名称基于时间戳自动生成,格式为:`compare_result_rank{npu_ID}-rank{cpu/gpu/npu_ID}_{timestamp}.xlsx`。 | 是 |
|
|
217
|
+
| **kwargs | 支持 compare 的所有可选参数。 | 否 |
|
|
218
|
+
|
|
219
|
+
**函数示例**:
|
|
167
220
|
|
|
168
221
|
```Python
|
|
169
|
-
from msprobe.pytorch import
|
|
170
|
-
|
|
171
|
-
"npu_json_path": "./npu_dump/dump.json",
|
|
172
|
-
"bench_json_path": "./bench_dump/dump.json",
|
|
173
|
-
"stack_json_path": "./npu_dump/stack.json",
|
|
174
|
-
"is_print_compare_log": True
|
|
175
|
-
}
|
|
176
|
-
compare(input_param, output_path="./output", stack_mode=True)
|
|
222
|
+
from msprobe.pytorch import *
|
|
223
|
+
compare_distributed('./npu_dump/step0', './gpu_dump/step0', './output')
|
|
177
224
|
```
|
|
178
225
|
|
|
179
|
-
|
|
226
|
+
## 3 精度比对结果分析
|
|
227
|
+
|
|
228
|
+
PyTorch 精度比对是以 CPU 或 GPU 的计算结果为标杆,通过计算精度评价指标判断 API 在运行时是否存在精度问题。
|
|
180
229
|
|
|
181
|
-
|
|
230
|
+
- `advisor_{timestamp}.txt` 文件中给出了可能存在精度问题的 API 的专家建议。
|
|
182
231
|
|
|
183
|
-
-
|
|
232
|
+
- `compare_result_{timestamp}.xlsx` 文件列出了所有执行精度比对的 API 详细信息和比对结果,示例如下:
|
|
184
233
|
|
|
185
|
-

|
|
186
235
|
|
|
187
|
-
|
|
236
|
+
- **提示**:比对结果通过颜色标记、比对结果(Result)、计算精度达标情况(Accuracy Reached no Not)、错误信息提示(Err_Message)定位可疑算子,但鉴于每种指标都有对应的判定标准,还需要结合实际情况进行判断。
|
|
188
237
|
|
|
189
|
-
|
|
238
|
+
### 3.1 指标说明
|
|
190
239
|
|
|
191
|
-
|
|
240
|
+
精度比对从三个层面评估 API 的精度,依次是:真实数据模式、统计数据模式和 MD5 模式。比对结果分别有不同的表头。
|
|
192
241
|
|
|
193
|
-
|
|
242
|
+
**公共表头**:
|
|
194
243
|
|
|
195
|
-
|
|
244
|
+
|dump 数据模式|NPU Name (NPU 的 API 名)|Bench Name (bench 的 API 名)|NPU Dtype (NPU 数据类型)|Bench Dtype (bench 数据类型)|NPU Tensor Shape (NPU 张量形状)|Bench Tensor Shape (bench 张量形状)|
|
|
245
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
246
|
+
|真实数据模式|√|√|√|√|√|√|
|
|
247
|
+
|统计数据模式|√|√|√|√|√|√|
|
|
248
|
+
|MD5 模式|√|√|√|√|√|√|
|
|
196
249
|
|
|
197
|
-
|
|
250
|
+
**个性表头**:
|
|
198
251
|
|
|
199
|
-
|
|
252
|
+
统计量有 4 种:最大值(max)、最小值(min)、平均值(mean)和 L2-范数(L2 norm)。
|
|
200
253
|
|
|
201
|
-
-
|
|
254
|
+
|dump 数据模式|Cosine (tensor 余弦相似度)|MaxAbsErr (tensor 最大绝对误差)|MaxRelativeErr (tensor 最大相对误差)|One Thousandth Err Ratio (tensor 相对误差小于千分之一的比例)|Five Thousandth Err Ratio (tensor 相对误差小于千分之五的比例)|NPU 和 bench 的统计量绝对误差 (max, min, mean, L2 norm) diff| NPU 和 bench 的统计量相对误差 (max, min, mean, L2 norm) RelativeErr |NPU 和 bench 的统计量 (max, min, mean, L2 norm)|NPU MD5 (NPU 数据 CRC-32 值)|BENCH MD5 (bench 数据 CRC-32 值)|Result (比对结果)|Accuracy Reached or Not (计算精度是否达标)|Err_message (错误信息提示)|NPU_Stack_Info (堆栈信息)|Data_Name (NPU 真实数据名)|
|
|
255
|
+
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
256
|
+
|真实数据模式|√|√|√|√|√|||√||||√|√|√|√|
|
|
257
|
+
|统计数据模式||||||√|√|√|||√||√|√||
|
|
258
|
+
|MD5 模式|||||||||√|√|√|||√||
|
|
202
259
|
|
|
203
|
-
|
|
260
|
+
上表中NPU_Stack_Info字段需要配置-s参数生成。
|
|
204
261
|
|
|
205
|
-
|
|
262
|
+
### 3.2 颜色标记——真实数据模式、统计数据模式
|
|
206
263
|
|
|
207
|
-
|
|
264
|
+
在比对结果中的Err_message列呈现比对结果颜色标记的原因,具体含义如下:
|
|
208
265
|
|
|
209
|
-
|
|
266
|
+
红色标记情况:
|
|
267
|
+
1. 一个 API 或模块的 One Thousandth Err Ratio 的 input > 0.9 同时 output < 0.6(真实数据模式);
|
|
268
|
+
2. 一个 API 或模块的 output 的最大值相对误差 (Max diff 除以 max(0.01, Bench max)) > 0.5(统计数据模式);
|
|
269
|
+
3. 一个 API 或模块的 NPU 的最大值或最小值中存在 nan/inf/-inf(真实数据模式、统计数据模式);
|
|
270
|
+
4. 一个 API 或模块的最大值绝对误差大于 1e+10(真实数据模式,统计数据模式)。
|
|
210
271
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
272
|
+
黄色标记情况:
|
|
273
|
+
1. 一个 API 或模块的 One Thousandth Err Ratio 的 input - output > 0.1(真实数据模式);
|
|
274
|
+
2. 一个 API 或模块的 Cosine 的 input - output > 0.1(真实数据模式);
|
|
275
|
+
3. 一个 API 或模块的 output 的最大值相对误差 > 0.1 同时 input < 0.01(真实数据模式,统计数据模式);
|
|
276
|
+
4. 一个 API 或模块的 input 与 output 的最大值绝对误差都大于 1,同时 output 比 input 大一个数量级以上(真实数据模式、统计数据模式)。
|
|
215
277
|
|
|
216
|
-
### 3.
|
|
278
|
+
### 3.3 比对结果(Result)——统计数据模式、MD5 模式
|
|
217
279
|
|
|
218
|
-
|
|
280
|
+
统计数据模式:
|
|
281
|
+
1. Warning 情况:4种统计值至少一种相对误差 > 0.5,要重点检查该 API;
|
|
282
|
+
2. 空情况:相对误差 ≤ 0.5,可以不需要重点关注,但不代表不存在精度问题;
|
|
283
|
+
3. N/A 情况:API 没有匹配上。
|
|
219
284
|
|
|
220
|
-
|
|
285
|
+
MD5 模式:
|
|
286
|
+
1. Pass 情况:NPU 与标杆的 CRC-32 值一致,即 API 数据完全一致;
|
|
287
|
+
2. Different 情况:NPU 与标杆的 CRC-32 值不一致,即 API 数据不完全一致;
|
|
288
|
+
3. N/A 情况:API 没有匹配上。
|
|
221
289
|
|
|
222
|
-
3.
|
|
290
|
+
### 3.4 判断计算精度达标情况(Accuracy Reached or Not)——真实数据模式
|
|
223
291
|
|
|
224
|
-
|
|
292
|
+
标记为 `No`,表示精度不达标:
|
|
293
|
+
1. Cosine < 0.99 且 MaxAbsError > 0.001;
|
|
294
|
+
2. Cosine < 0.9;
|
|
295
|
+
3. MaxAbsError > 1;
|
|
296
|
+
4. Cosine 或 MaxAbsError 计算结果为 N/A(NPU 和 Bench 的数据有 nan/inf)。
|
|
225
297
|
|
|
226
|
-
|
|
298
|
+
标记为 `None`:
|
|
299
|
+
1. Cosine 或 MaxAbsError 计算结果为 None(读取到的数据为空);
|
|
300
|
+
2. Cosine 或 MaxAbsError 计算结果无法转换为浮点型。
|
|
227
301
|
|
|
228
|
-
|
|
302
|
+
标记为 `Unmatched`:
|
|
303
|
+
1. Cosine 计算结果为 `shape unmatched`(NPU 和 Bench 的数据结构不一致)。
|
|
229
304
|
|
|
230
|
-
|
|
305
|
+
标记为 `Yes`,表示精度达标:
|
|
306
|
+
1. 除以上情况外的其余情况。
|
|
231
307
|
|
|
232
|
-
|
|
233
|
-
- NPU max 或 NPU min 信息中存在 nan/inf;
|
|
234
|
-
- Max diff存在大于1e+10的值;
|
|
235
|
-
- 统计数据中output的Max diff除以max(0.01, Bench max) > 0.5;
|
|
236
|
-
- 真实数据中One Thousandth Err Ratio的input > 0.9同时output < 0.6。
|
|
237
|
-
- 黄色可能出现的情况有:
|
|
238
|
-
- Max diff的input与output都大于1,同时output比input大一个数量级以上;
|
|
239
|
-
- 统计数据Max diff除以max(0.01, Bench max)的output > 0.1同时input < 0.01;
|
|
240
|
-
- 真实数据One Thousandth Err Ratio的input - output > 0.1;
|
|
241
|
-
- 真实数据Cosine的input - output > 0.1。
|
|
308
|
+
### 3.5 错误信息提示(Err_message)——真实数据模式、统计数据模式
|
|
242
309
|
|
|
243
|
-
|
|
310
|
+
1. "Need double check api accuracy.":四个统计值中至少 1 个相对误差 > 0.5(统计数据模式);
|
|
311
|
+
2. "Fuzzy matching data, the comparison arruracy may be affected.":NPU 或 Bench 的真实数据名没有匹配上(真实数据模式);
|
|
312
|
+
3. "Dump file: {} not found.":NPU 真实数据不存在或者读取出错(真实数据模式);
|
|
313
|
+
4. "No bench data matched.":Bench 的 API 没有匹配上、Bench 真实数据不存在或读取出错(真实数据模式);
|
|
314
|
+
5. "This is empty data, can not compare.":读取到的数据为空(真实数据模式);
|
|
315
|
+
6. "Shape of NPU and bench Tensor do not match. Skipped.":NPU 和 Bench 的数据结构不一致(真实数据模式);
|
|
316
|
+
7. "The Position of inf or nan in NPU and bench Tensor do not match.":NPU 和 Bench 的数据有 nan/inf(真实数据模式);
|
|
317
|
+
8. "This is type of scalar data, can not compare.":NPU 为标量(真实数据模式);
|
|
318
|
+
9. "Dtype of NPU and bench Tensor do not match.":NPU 和 Bench 数据的数据类型不同(真实数据模式);
|
|
319
|
+
10. "":除以上情况的其余情况(真实数据模式、统计数据模式)。
|
|
244
320
|
|
|
245
|
-
|
|
321
|
+
除以上错误信息提示外,异常数据颜色高亮标记的原因叠加呈现于此列。
|
|
322
|
+
|
|
323
|
+
### 3.6 计算精度评价指标分析
|
|
324
|
+
|
|
325
|
+
1. Cosine:通过计算两个向量的余弦值来判断其相似度,数值越接近于 1 说明计算出的两个张量越相似,实际可接受阈值为大于 0.99。在计算中可能会存在 nan,主要由于可能会出现其中一个向量为 0。
|
|
326
|
+
|
|
327
|
+
2. MaxAbsErr:当最大绝对误差越接近 0 表示其计算的误差越小,实际可接受阈值为小于 0.001。
|
|
328
|
+
|
|
329
|
+
3. MaxRelativeErr:当最大相对误差越接近 0 表示其计算的误差越小。
|
|
330
|
+
|
|
331
|
+
当 dump 数据中存在 0 或 Nan 时,比对结果中最大相对误差则出现 inf 或 Nan 的情况,属于正常现象。
|
|
332
|
+
|
|
333
|
+
4. One Thousandth Err Ratio(双千分之一)、Five Thousandths Err Ratio(双千分之五)精度指标:是指 NPU 的 Tensor 中的元素逐个与对应的标杆数据对比,相对误差大于千分之一、千分之五的比例占总元素个数的比例小于千分之一、千分之五。该数据仅作为精度下降趋势的参考,并不参与计算精度是否通过的判定。
|