mindstudio-probe 8.3.2__py3-none-any.whl → 26.0.0a1__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-8.3.2.dist-info → mindstudio_probe-26.0.0a1.dist-info}/METADATA +26 -14
- mindstudio_probe-26.0.0a1.dist-info/RECORD +498 -0
- {mindstudio_probe-8.3.2.dist-info → mindstudio_probe-26.0.0a1.dist-info}/WHEEL +1 -1
- mindstudio_probe-26.0.0a1.dist-info/entry_points.txt +5 -0
- mindstudio_probe-26.0.0a1.dist-info/licenses/LICENSE +124 -0
- mindstudio_probe-26.0.0a1.dist-info/top_level.txt +2 -0
- msprobe/__init__.py +12 -13
- msprobe/config.json +9 -31
- msprobe/core/__init__.py +12 -11
- msprobe/core/acc_check/acc_check_cli.py +145 -0
- msprobe/core/common/const.py +97 -38
- msprobe/core/common/db_manager.py +133 -12
- msprobe/core/common/decorator.py +12 -11
- msprobe/core/common/exceptions.py +12 -11
- msprobe/core/common/file_utils.py +101 -25
- msprobe/core/common/framework_adapter.py +36 -25
- msprobe/core/common/global_lock.py +12 -11
- msprobe/core/common/inplace_op_checker.py +12 -11
- msprobe/core/common/log.py +22 -11
- msprobe/core/common/megatron_utils.py +566 -11
- msprobe/core/common/parallel_state.py +12 -11
- msprobe/core/common/runtime.py +12 -11
- msprobe/core/common/utils.py +41 -41
- msprobe/core/compare/acc_compare.py +361 -104
- msprobe/core/compare/atb_data_compare.py +422 -0
- msprobe/core/compare/auto_compare.py +134 -0
- msprobe/core/compare/check.py +14 -17
- msprobe/core/compare/compare_cli.py +72 -149
- msprobe/core/compare/config.py +12 -13
- msprobe/core/compare/diff_analyze/first_diff_analyze.py +28 -15
- msprobe/core/compare/diff_analyze/ignore_op_list.yaml +3 -0
- msprobe/core/compare/find_first/analyzer.py +18 -18
- msprobe/core/compare/find_first/graph.py +12 -11
- msprobe/core/compare/find_first/utils.py +13 -12
- msprobe/core/compare/indicator_analysis/__init__.py +15 -0
- msprobe/core/compare/indicator_analysis/algorithm.py +363 -0
- msprobe/core/compare/indicator_analysis/api_data.py +141 -0
- msprobe/core/compare/indicator_analysis/calculator.py +181 -0
- msprobe/core/compare/indicator_analysis/utils.py +116 -0
- msprobe/core/compare/layer_mapping/__init__.py +12 -11
- msprobe/core/compare/layer_mapping/data_scope_parser.py +20 -11
- msprobe/core/compare/layer_mapping/layer_mapping.py +14 -13
- msprobe/core/compare/layer_mapping/postprocess_pass.py +13 -11
- msprobe/core/compare/merge_result/merge_result.py +12 -11
- msprobe/core/compare/merge_result/merge_result_cli.py +12 -11
- msprobe/core/compare/merge_result/utils.py +12 -11
- msprobe/core/compare/multiprocessing_compute.py +13 -14
- msprobe/core/compare/npy_compare.py +13 -11
- msprobe/core/compare/offline_data_compare.py +160 -0
- msprobe/core/compare/stats_diff_calc.py +39 -0
- msprobe/core/compare/torchair_acc_cmp.py +764 -0
- msprobe/core/compare/torchair_cmp_utils.py +338 -0
- msprobe/core/compare/utils.py +140 -49
- msprobe/core/config_check/__init__.py +12 -11
- msprobe/core/config_check/checkers/__init__.py +12 -11
- msprobe/core/config_check/checkers/base_checker.py +15 -14
- msprobe/core/config_check/checkers/dataset_checker.py +13 -12
- msprobe/core/config_check/checkers/env_args_checker.py +13 -12
- msprobe/core/config_check/checkers/hyperparameter_checker.py +16 -15
- msprobe/core/config_check/checkers/pip_checker.py +15 -15
- msprobe/core/config_check/checkers/random_checker.py +13 -12
- msprobe/core/config_check/checkers/weights_checker.py +14 -12
- msprobe/core/config_check/ckpt_compare/ckpt_comparator.py +13 -17
- msprobe/core/config_check/ckpt_compare/megatron_loader.py +13 -12
- msprobe/core/config_check/ckpt_compare/metrics.py +12 -11
- msprobe/core/config_check/config_check_cli.py +18 -17
- msprobe/core/config_check/config_checker.py +16 -14
- msprobe/core/config_check/resource/dependency.yaml +15 -12
- msprobe/core/config_check/resource/env.yaml +12 -11
- msprobe/core/config_check/utils/hyperparameter_parser.py +12 -11
- msprobe/core/config_check/utils/utils.py +12 -11
- msprobe/core/{data_dump → dump/api_dump}/api_registry.py +12 -11
- msprobe/core/{common_config.py → dump/common_config.py} +13 -24
- msprobe/core/dump/data_dump/data_collector.py +257 -0
- msprobe/core/{data_dump → dump/data_dump}/data_processor/base.py +45 -36
- msprobe/core/{data_dump → dump/data_dump}/data_processor/factory.py +33 -25
- msprobe/core/{data_dump → dump/data_dump}/data_processor/mindspore_processor.py +37 -113
- msprobe/core/{data_dump → dump/data_dump}/data_processor/pytorch_processor.py +364 -131
- msprobe/core/{data_dump → dump/data_dump}/json_writer.py +24 -31
- msprobe/core/{data_dump → dump/data_dump}/scope.py +12 -13
- msprobe/core/{debugger → dump/debugger}/precision_debugger.py +15 -23
- msprobe/core/dump/dump2db/db_utils.py +215 -0
- msprobe/core/dump/dump2db/dump2db.py +409 -0
- msprobe/core/{hook_manager.py → dump/hook_manager.py} +38 -87
- msprobe/core/dump/kernel_dump/kernel_config.py +34 -0
- msprobe/core/{service.py → dump/service.py} +43 -27
- msprobe/core/install_deps/install_deps.py +51 -0
- msprobe/core/monitor/anomaly_processor.py +13 -11
- msprobe/core/monitor/csv2db.py +73 -93
- msprobe/core/monitor/db_utils.py +140 -205
- msprobe/core/monitor/utils.py +18 -17
- msprobe/core/monitor_v2/__init__.py +20 -0
- msprobe/core/monitor_v2/base.py +83 -0
- msprobe/core/monitor_v2/cc.py +287 -0
- msprobe/core/monitor_v2/factory.py +81 -0
- msprobe/core/monitor_v2/module.py +201 -0
- msprobe/core/monitor_v2/optimizer.py +245 -0
- msprobe/core/monitor_v2/param.py +154 -0
- msprobe/core/monitor_v2/trainer.py +326 -0
- msprobe/core/monitor_v2/utils.py +122 -0
- msprobe/core/monitor_v2/weight_grad.py +419 -0
- msprobe/core/monitor_v2/writer.py +162 -0
- msprobe/core/overflow_check/abnormal_scene.py +12 -11
- msprobe/core/overflow_check/api_info.py +12 -11
- msprobe/core/overflow_check/checker.py +12 -11
- msprobe/core/overflow_check/filter.py +13 -11
- msprobe/core/overflow_check/level.py +12 -11
- msprobe/core/overflow_check/utils.py +12 -11
- msprobe/core/single_save/single_comparator.py +12 -11
- msprobe/core/single_save/single_saver.py +12 -11
- msprobe/infer/__init__.py +16 -0
- msprobe/infer/offline/__init__.py +16 -0
- msprobe/infer/offline/compare/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/adapter_cli/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/adapter_cli/args_adapter.py +46 -0
- msprobe/infer/offline/compare/msquickcmp/atc/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/atc/atc_utils.py +98 -0
- msprobe/infer/offline/compare/msquickcmp/cmp_process.py +328 -0
- msprobe/infer/offline/compare/msquickcmp/common/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/common/args_check.py +112 -0
- msprobe/infer/offline/compare/msquickcmp/common/convert.py +74 -0
- msprobe/infer/offline/compare/msquickcmp/common/dump_data.py +121 -0
- msprobe/infer/offline/compare/msquickcmp/common/dynamic_argument_bean.py +39 -0
- msprobe/infer/offline/compare/msquickcmp/common/utils.py +669 -0
- msprobe/infer/offline/compare/msquickcmp/config.ini +6 -0
- msprobe/infer/offline/compare/msquickcmp/dump/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/dump/args_adapter.py +50 -0
- msprobe/infer/offline/compare/msquickcmp/dump/dump_process.py +91 -0
- msprobe/infer/offline/compare/msquickcmp/install_aclruntime_aisbench.sh +180 -0
- msprobe/infer/offline/compare/msquickcmp/main.py +199 -0
- msprobe/infer/offline/compare/msquickcmp/net_compare/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/net_compare/net_compare.py +277 -0
- msprobe/infer/offline/compare/msquickcmp/npu/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/npu/npu_dump_data.py +558 -0
- msprobe/infer/offline/compare/msquickcmp/npu/om_parser.py +416 -0
- msprobe/infer/offline/compare/msquickcmp/onnx_model/__init__.py +16 -0
- msprobe/infer/offline/compare/msquickcmp/onnx_model/onnx_dump_data.py +374 -0
- msprobe/infer/utils/__init__.py +15 -0
- msprobe/infer/utils/acc_cmp.py +94 -0
- msprobe/infer/utils/check/__init__.py +37 -0
- msprobe/infer/utils/check/args_checker.py +35 -0
- msprobe/infer/utils/check/checker.py +227 -0
- msprobe/infer/utils/check/dict_checker.py +78 -0
- msprobe/infer/utils/check/func_wrapper.py +96 -0
- msprobe/infer/utils/check/list_checker.py +56 -0
- msprobe/infer/utils/check/number_checker.py +64 -0
- msprobe/infer/utils/check/obj_checker.py +41 -0
- msprobe/infer/utils/check/path_checker.py +249 -0
- msprobe/infer/utils/check/rule.py +126 -0
- msprobe/infer/utils/check/string_checker.py +66 -0
- msprobe/infer/utils/cmp_algorithm.py +261 -0
- msprobe/infer/utils/constants.py +112 -0
- msprobe/infer/utils/file_open_check.py +337 -0
- msprobe/infer/utils/util.py +177 -0
- msprobe/mindspore/__init__.py +14 -13
- msprobe/mindspore/api_accuracy_checker/api_accuracy_checker.py +14 -13
- msprobe/mindspore/api_accuracy_checker/api_info.py +12 -11
- msprobe/mindspore/api_accuracy_checker/api_runner.py +12 -11
- msprobe/mindspore/api_accuracy_checker/base_compare_algorithm.py +12 -11
- msprobe/mindspore/api_accuracy_checker/bench_functions/flash_attention_score.py +12 -11
- msprobe/mindspore/api_accuracy_checker/bench_functions/fusion_operator.py +12 -11
- msprobe/mindspore/api_accuracy_checker/checker_support_api.yaml +12 -11
- msprobe/mindspore/api_accuracy_checker/cmd_parser.py +15 -14
- msprobe/mindspore/api_accuracy_checker/compute_element.py +12 -11
- msprobe/mindspore/api_accuracy_checker/data_manager.py +13 -11
- msprobe/mindspore/api_accuracy_checker/main.py +12 -11
- msprobe/mindspore/api_accuracy_checker/multi_api_accuracy_checker.py +14 -12
- msprobe/mindspore/api_accuracy_checker/multi_data_manager.py +13 -11
- msprobe/mindspore/api_accuracy_checker/torch_mindtorch_importer.py +12 -11
- msprobe/mindspore/api_accuracy_checker/type_mapping.py +12 -11
- msprobe/mindspore/api_accuracy_checker/utils.py +12 -11
- msprobe/mindspore/common/const.py +15 -74
- msprobe/mindspore/common/log.py +12 -11
- msprobe/mindspore/common/utils.py +30 -15
- msprobe/mindspore/compare/common_dir_compare.py +21 -23
- msprobe/mindspore/compare/distributed_compare.py +18 -16
- msprobe/mindspore/compare/ms_compare.py +14 -14
- msprobe/mindspore/compare/ms_graph_compare.py +26 -20
- msprobe/mindspore/compare/utils.py +14 -12
- msprobe/mindspore/{cell_processor.py → dump/cell_processor.py} +15 -14
- msprobe/mindspore/{debugger → dump/debugger}/debugger_config.py +12 -30
- msprobe/mindspore/{debugger → dump/debugger}/precision_debugger.py +43 -45
- msprobe/mindspore/dump/{cell_dump_process.py → dump_processor/cell_dump_process.py} +31 -17
- msprobe/mindspore/dump/{cell_dump_with_insert_gradient.py → dump_processor/cell_dump_with_insert_gradient.py} +18 -14
- msprobe/mindspore/dump/{dump_tool_factory.py → dump_processor/dump_tool_factory.py} +16 -15
- msprobe/mindspore/dump/{graph_mode_cell_dump.py → dump_processor/graph_mode_cell_dump.py} +16 -15
- msprobe/mindspore/dump/{graph_tensor_dump.py → dump_processor/graph_tensor_dump.py} +134 -133
- msprobe/mindspore/dump/{hook_cell → dump_processor/hook_cell}/api_register.py +15 -14
- msprobe/mindspore/dump/{hook_cell → dump_processor/hook_cell}/hook_cell.py +12 -11
- msprobe/mindspore/dump/{hook_cell → dump_processor/hook_cell}/ms_hook_manager.py +47 -20
- msprobe/mindspore/dump/{hook_cell → dump_processor/hook_cell}/primitive_hooks.py +14 -13
- msprobe/mindspore/dump/{hook_cell → dump_processor/hook_cell}/support_wrap_ops.yaml +13 -11
- msprobe/mindspore/dump/{jit_dump.py → dump_processor/jit_dump.py} +14 -13
- msprobe/mindspore/dump/{kernel_graph_dump.py → dump_processor/kernel_graph_dump.py} +13 -12
- msprobe/mindspore/dump/{kernel_kbyk_dump.py → dump_processor/kernel_kbyk_dump.py} +13 -12
- msprobe/mindspore/{exception_dump → dump/exception_dump}/exception_dump_tool_factory.py +14 -13
- msprobe/mindspore/{exception_dump → dump/exception_dump}/kernel_graph_exception_dump.py +13 -12
- msprobe/mindspore/{mindspore_service.py → dump/mindspore_service.py} +18 -17
- msprobe/mindspore/dump/mindtorch/__init__.py +19 -0
- msprobe/mindspore/dump/ms_config.py +105 -0
- msprobe/mindspore/{overflow_check → dump/overflow_check}/kernel_graph_overflow_check.py +13 -12
- msprobe/mindspore/{overflow_check → dump/overflow_check}/overflow_check_tool_factory.py +14 -13
- msprobe/mindspore/dump/task_handler_factory.py +43 -0
- msprobe/mindspore/monitor/common_func.py +12 -11
- msprobe/mindspore/monitor/data_writers.py +12 -11
- msprobe/mindspore/monitor/distributed/wrap_distributed.py +93 -39
- msprobe/mindspore/monitor/features.py +12 -11
- msprobe/mindspore/monitor/module_hook.py +19 -22
- msprobe/mindspore/monitor/optimizer_collect.py +29 -25
- msprobe/mindspore/monitor/utils.py +13 -11
- msprobe/msaccucmp/advisor/__init__.py +16 -0
- msprobe/msaccucmp/advisor/advisor_const.py +65 -0
- msprobe/msaccucmp/advisor/advisor_result.py +73 -0
- msprobe/msaccucmp/advisor/compare_advisor.py +99 -0
- msprobe/msaccucmp/advisor/input_advisor.py +66 -0
- msprobe/msaccucmp/advisor/node_advisor.py +68 -0
- msprobe/msaccucmp/advisor/overflow_advisor.py +58 -0
- msprobe/msaccucmp/algorithm_manager/__init__.py +16 -0
- msprobe/msaccucmp/algorithm_manager/algorithm_manager.py +464 -0
- msprobe/msaccucmp/algorithm_manager/algorithm_parameter.py +42 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_AccumulatedRelativeError.py +46 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_CosineSimilarity.py +58 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_KullbackLeiblerDivergence.py +84 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_MaxAbsoluteError.py +41 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_MaxRelativeError.py +46 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_MeanAbsoluteError.py +41 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_MeanRelativeError.py +46 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_RelativeEuclideanDistance.py +46 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_RootMeanSquareError.py +40 -0
- msprobe/msaccucmp/algorithm_manager/builtin_algorithm/alg_StandardDeviation.py +47 -0
- msprobe/msaccucmp/cmp_utils/__init__.py +16 -0
- msprobe/msaccucmp/cmp_utils/common.py +113 -0
- msprobe/msaccucmp/cmp_utils/constant/__init__.py +16 -0
- msprobe/msaccucmp/cmp_utils/constant/compare_error.py +81 -0
- msprobe/msaccucmp/cmp_utils/constant/const_manager.py +530 -0
- msprobe/msaccucmp/cmp_utils/file_utils.py +497 -0
- msprobe/msaccucmp/cmp_utils/log.py +257 -0
- msprobe/msaccucmp/cmp_utils/multi_process/__init__.py +16 -0
- msprobe/msaccucmp/cmp_utils/multi_process/multi_convert_process.py +140 -0
- msprobe/msaccucmp/cmp_utils/multi_process/progress.py +78 -0
- msprobe/msaccucmp/cmp_utils/path_check.py +274 -0
- msprobe/msaccucmp/cmp_utils/reg_manager.py +98 -0
- msprobe/msaccucmp/cmp_utils/tlv_parse.py +279 -0
- msprobe/msaccucmp/cmp_utils/utils.py +356 -0
- msprobe/msaccucmp/cmp_utils/utils_type.py +63 -0
- msprobe/msaccucmp/compare_vector.py +48 -0
- msprobe/msaccucmp/conversion/__init__.py +16 -0
- msprobe/msaccucmp/conversion/data_conversion.py +277 -0
- msprobe/msaccucmp/conversion/dtype_conversion.py +99 -0
- msprobe/msaccucmp/conversion/shape_format_conversion.py +477 -0
- msprobe/msaccucmp/conversion/tensor_conversion.py +369 -0
- msprobe/msaccucmp/dump_data_conversion.py +46 -0
- msprobe/msaccucmp/dump_parse/__init__.py +16 -0
- msprobe/msaccucmp/dump_parse/big_dump_data.py +317 -0
- msprobe/msaccucmp/dump_parse/dump.py +423 -0
- msprobe/msaccucmp/dump_parse/dump_data_object.py +322 -0
- msprobe/msaccucmp/dump_parse/dump_data_parser.py +436 -0
- msprobe/msaccucmp/dump_parse/dump_utils.py +246 -0
- msprobe/msaccucmp/dump_parse/ffts_parser.py +137 -0
- msprobe/msaccucmp/dump_parse/mapping.py +62 -0
- msprobe/msaccucmp/dump_parse/nano_dump_data.py +392 -0
- msprobe/msaccucmp/dump_parse/proto_dump_data.py +308 -0
- msprobe/msaccucmp/dump_parser.py +90 -0
- msprobe/msaccucmp/format_manager/__init__.py +16 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_FRACTAL_NZ_to_NCHW.py +53 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_FRACTAL_NZ_to_ND.py +52 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_FRACTAL_NZ_to_NHWC.py +53 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_FRACTAL_Z_to_HWCN.py +47 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_FRACTAL_Z_to_NCHW.py +47 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_HWCN_to_FRACTAL_Z.py +89 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_HWCN_to_NCHW.py +37 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_HWCN_to_NHWC.py +37 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NC1HWC0_to_HWCN.py +43 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NC1HWC0_to_NCHW.py +48 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NC1HWC0_to_NHWC.py +43 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NCHW_to_FRACTAL_Z.py +87 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NCHW_to_NHWC.py +37 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NDC1HWC0_to_NCDHW.py +48 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NDC1HWC0_to_ND.py +44 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NHWC_to_FRACTAL_Z.py +87 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NHWC_to_HWCN.py +37 -0
- msprobe/msaccucmp/format_manager/builtin_format_convert/convert_NHWC_to_NCHW.py +37 -0
- msprobe/msaccucmp/format_manager/format_manager.py +307 -0
- msprobe/msaccucmp/inplace_layer_process.py +186 -0
- msprobe/msaccucmp/msaccucmp.py +532 -0
- msprobe/msaccucmp/mscmp_advisor.py +128 -0
- msprobe/msaccucmp/overflow/__init__.py +16 -0
- msprobe/msaccucmp/overflow/overflow_analyse.py +305 -0
- msprobe/msaccucmp/overflow/overflow_detection.py +143 -0
- msprobe/msaccucmp/pytorch_cmp/__init__.py +16 -0
- msprobe/msaccucmp/pytorch_cmp/compare_pytorch.py +389 -0
- msprobe/msaccucmp/pytorch_cmp/hdf5_parser.py +377 -0
- msprobe/msaccucmp/pytorch_cmp/pytorch_dump_data.py +461 -0
- msprobe/msaccucmp/shape_conversion.py +41 -0
- msprobe/msaccucmp/vector_cmp/__init__.py +16 -0
- msprobe/msaccucmp/vector_cmp/batch_compare.py +197 -0
- msprobe/msaccucmp/vector_cmp/compare_detail/__init__.py +16 -0
- msprobe/msaccucmp/vector_cmp/compare_detail/compare_detail.py +245 -0
- msprobe/msaccucmp/vector_cmp/compare_detail/detail.py +182 -0
- msprobe/msaccucmp/vector_cmp/compare_detail/detail_writer.py +580 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/__init__.py +16 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/compare_fusion_op.py +588 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/compare_npu_vs_npu.py +339 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/compare_result.py +326 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/compare_rule.py +156 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/fusion_op.py +204 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/fusion_rule_parser.py +635 -0
- msprobe/msaccucmp/vector_cmp/fusion_manager/quant_filter.py +187 -0
- msprobe/msaccucmp/vector_cmp/range_manager/__init__.py +16 -0
- msprobe/msaccucmp/vector_cmp/range_manager/range_manager.py +100 -0
- msprobe/msaccucmp/vector_cmp/range_manager/range_mode.py +94 -0
- msprobe/msaccucmp/vector_cmp/range_manager/select_mode.py +86 -0
- msprobe/msaccucmp/vector_cmp/vector_comparison.py +535 -0
- msprobe/msprobe.py +101 -130
- msprobe/overflow_check/__init__.py +15 -0
- msprobe/{nan_analyze → overflow_check}/analyzer.py +38 -27
- msprobe/{nan_analyze → overflow_check}/graph.py +30 -27
- msprobe/{nan_analyze → overflow_check}/utils.py +15 -14
- msprobe/pytorch/__init__.py +20 -14
- msprobe/pytorch/aclgraph_dump/__init__.py +45 -0
- msprobe/pytorch/aclgraph_dump/_meta.py +26 -0
- msprobe/pytorch/api_accuracy_checker/{run_ut/run_ut.py → acc_check/acc_check.py} +50 -45
- msprobe/pytorch/api_accuracy_checker/{run_ut/run_ut_utils.py → acc_check/acc_check_utils.py} +201 -30
- msprobe/pytorch/api_accuracy_checker/{run_ut → acc_check}/data_generate.py +56 -16
- msprobe/pytorch/api_accuracy_checker/{run_ut/multi_run_ut.py → acc_check/multi_acc_check.py} +32 -47
- msprobe/pytorch/api_accuracy_checker/{run_ut → acc_check}/run_overflow_check.py +19 -18
- msprobe/pytorch/api_accuracy_checker/common/config.py +22 -20
- msprobe/pytorch/api_accuracy_checker/common/utils.py +72 -13
- msprobe/pytorch/api_accuracy_checker/compare/algorithm.py +41 -11
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_compare.py +23 -14
- msprobe/pytorch/api_accuracy_checker/compare/compare.py +45 -32
- msprobe/pytorch/api_accuracy_checker/compare/compare_column.py +12 -11
- msprobe/pytorch/api_accuracy_checker/compare/compare_input.py +14 -12
- msprobe/pytorch/api_accuracy_checker/compare/compare_utils.py +14 -12
- msprobe/pytorch/api_accuracy_checker/precision_standard/absolute_threshold.py +12 -11
- msprobe/pytorch/api_accuracy_checker/precision_standard/accumulative_error_compare.py +12 -11
- msprobe/pytorch/api_accuracy_checker/precision_standard/base_standard.py +21 -19
- msprobe/pytorch/api_accuracy_checker/precision_standard/benchmark_compare.py +14 -13
- msprobe/pytorch/api_accuracy_checker/precision_standard/binary_consistency.py +12 -11
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_config.py +60 -11
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_register.py +27 -16
- msprobe/pytorch/api_accuracy_checker/precision_standard/thousandth_standard.py +13 -11
- msprobe/pytorch/api_accuracy_checker/precision_standard/ulp_compare.py +39 -18
- msprobe/pytorch/bench_functions/__init__.py +12 -11
- msprobe/pytorch/bench_functions/apply_adam.py +12 -11
- msprobe/pytorch/bench_functions/apply_adam_w.py +12 -11
- msprobe/pytorch/bench_functions/confusion_transpose.py +12 -11
- msprobe/pytorch/bench_functions/fast_gelu.py +12 -11
- msprobe/pytorch/bench_functions/group_norm_silu.py +12 -11
- msprobe/pytorch/bench_functions/layer_norm_eval.py +12 -11
- msprobe/pytorch/bench_functions/linear.py +12 -11
- msprobe/pytorch/bench_functions/matmul_backward.py +12 -11
- msprobe/pytorch/bench_functions/mish.py +12 -11
- msprobe/pytorch/bench_functions/moe_gating_top_k_softmax.py +12 -11
- msprobe/pytorch/bench_functions/npu_fusion_attention.py +12 -11
- msprobe/pytorch/bench_functions/rms_norm.py +12 -11
- msprobe/pytorch/bench_functions/rotary_mul.py +12 -11
- msprobe/pytorch/bench_functions/scaled_mask_softmax.py +12 -11
- msprobe/pytorch/bench_functions/sort_v2.py +12 -11
- msprobe/pytorch/bench_functions/swiglu.py +12 -11
- msprobe/pytorch/common/__init__.py +12 -11
- msprobe/pytorch/common/log.py +12 -11
- msprobe/pytorch/common/parse_json.py +12 -11
- msprobe/pytorch/common/utils.py +52 -19
- msprobe/pytorch/compare/distributed_compare.py +13 -13
- msprobe/pytorch/compare/match.py +12 -11
- msprobe/pytorch/compare/pt_compare.py +14 -20
- msprobe/pytorch/compare/pt_diff_analyze.py +12 -11
- msprobe/pytorch/compare/utils.py +12 -11
- msprobe/pytorch/{hook_module → dump/api_dump}/api_register.py +18 -16
- msprobe/pytorch/{hook_module → dump/api_dump}/hook_module.py +14 -13
- msprobe/pytorch/{hook_module → dump/api_dump}/pt_hook_manager.py +68 -23
- msprobe/pytorch/{hook_module → dump/api_dump}/register_optimizer_hook.py +13 -11
- msprobe/pytorch/{hook_module → dump/api_dump}/script_wrapper.py +17 -14
- msprobe/pytorch/{hook_module → dump/api_dump}/utils.py +12 -11
- msprobe/pytorch/{debugger → dump/debugger}/debugger_config.py +23 -38
- msprobe/pytorch/dump/debugger/precision_debugger.py +130 -0
- msprobe/pytorch/{function_factory.py → dump/function_factory.py} +12 -11
- msprobe/pytorch/dump/module_dump/hook_wrapper.py +17 -13
- msprobe/pytorch/dump/module_dump/module_dump.py +16 -15
- msprobe/pytorch/dump/module_dump/{module_processer.py → module_processor.py} +54 -42
- msprobe/pytorch/dump/pt_config.py +128 -0
- msprobe/pytorch/{pytorch_service.py → dump/pytorch_service.py} +22 -21
- msprobe/pytorch/monitor/csv2tb.py +13 -11
- msprobe/pytorch/monitor/data_writers.py +13 -11
- msprobe/pytorch/monitor/distributed/wrap_distributed.py +13 -11
- msprobe/pytorch/monitor/features.py +12 -11
- msprobe/pytorch/monitor/module_hook.py +67 -59
- msprobe/pytorch/monitor/module_metric.py +13 -11
- msprobe/pytorch/monitor/optimizer_collect.py +37 -35
- msprobe/pytorch/monitor/utils.py +13 -11
- msprobe/pytorch/monitor/visualizer.py +12 -11
- msprobe/pytorch/torchair_dump/__init__.py +17 -0
- msprobe/pytorch/torchair_dump/torchair_dump.py +114 -0
- msprobe/scripts/atb/config_example.json +10 -0
- msprobe/scripts/atb/load_atb_probe.sh +101 -0
- msprobe/scripts/atb/unload_atb_probe.sh +27 -0
- msprobe/scripts/build_msaccucmp.sh +186 -0
- msprobe/scripts/conf/help.info +6 -0
- msprobe/scripts/conf/version.info +3 -0
- msprobe/scripts/run_script/common.sh +538 -0
- msprobe/scripts/run_script/main_msaccucmp.sh +232 -0
- msprobe/visualization/__init__.py +12 -11
- msprobe/visualization/builder/__init__.py +12 -11
- msprobe/visualization/builder/graph_builder.py +45 -30
- msprobe/visualization/builder/graph_merger.py +53 -32
- msprobe/visualization/builder/msprobe_adapter.py +34 -44
- msprobe/visualization/compare/__init__.py +12 -11
- msprobe/visualization/compare/graph_comparator.py +63 -51
- msprobe/visualization/compare/mode_adapter.py +28 -113
- msprobe/visualization/db_utils.py +133 -22
- msprobe/visualization/graph/__init__.py +12 -11
- msprobe/visualization/graph/base_node.py +15 -27
- msprobe/visualization/graph/distributed_analyzer.py +97 -40
- msprobe/visualization/graph/graph.py +14 -16
- msprobe/visualization/graph/node_colors.py +34 -31
- msprobe/visualization/graph/node_op.py +12 -11
- msprobe/visualization/graph_service.py +580 -205
- msprobe/visualization/utils.py +278 -31
- tb_graph_ascend/secure_build.py +175 -0
- tb_graph_ascend/server/__init__.py +15 -0
- tb_graph_ascend/server/app/__init__.py +15 -0
- tb_graph_ascend/server/app/model/__init__.py +15 -0
- tb_graph_ascend/server/app/model/hierarchy.py +348 -0
- tb_graph_ascend/server/app/model/layout_hierarchy_model.py +69 -0
- tb_graph_ascend/server/app/model/match_nodes_model.py +573 -0
- tb_graph_ascend/server/app/repositories/__init__.py +15 -0
- tb_graph_ascend/server/app/repositories/graph_repo_base.py +32 -0
- tb_graph_ascend/server/app/repositories/graph_repo_db.py +879 -0
- tb_graph_ascend/server/app/repositories/graph_repo_vis.py +83 -0
- tb_graph_ascend/server/app/service/__init__.py +18 -0
- tb_graph_ascend/server/app/service/graph_service_base.py +158 -0
- tb_graph_ascend/server/app/service/graph_service_db.py +438 -0
- tb_graph_ascend/server/app/service/graph_service_factory.py +54 -0
- tb_graph_ascend/server/app/service/graph_service_vis.py +480 -0
- tb_graph_ascend/server/app/utils/__init__.py +15 -0
- tb_graph_ascend/server/app/utils/constant.py +80 -0
- tb_graph_ascend/server/app/utils/file_check_wrapper.py +46 -0
- tb_graph_ascend/server/app/utils/global_state.py +95 -0
- tb_graph_ascend/server/app/utils/graph_utils.py +661 -0
- tb_graph_ascend/server/app/utils/i18n.py +153 -0
- tb_graph_ascend/server/app/utils/request_method.py +46 -0
- tb_graph_ascend/server/app/views/__init__.py +15 -0
- tb_graph_ascend/server/app/views/graph_views.py +304 -0
- tb_graph_ascend/server/plugin.py +108 -0
- tb_graph_ascend/server/static/index.html +9250 -0
- tb_graph_ascend/server/static/index.js +21 -0
- tb_graph_ascend/setup.py +57 -0
- mindstudio_probe-8.3.2.dist-info/LICENSE +0 -201
- mindstudio_probe-8.3.2.dist-info/RECORD +0 -491
- mindstudio_probe-8.3.2.dist-info/entry_points.txt +0 -2
- mindstudio_probe-8.3.2.dist-info/top_level.txt +0 -1
- msprobe/CMakeLists.txt +0 -5
- msprobe/README.md +0 -203
- msprobe/core/advisor/advisor.py +0 -129
- msprobe/core/advisor/advisor_const.py +0 -58
- msprobe/core/advisor/advisor_result.py +0 -58
- msprobe/core/compare/find_first/data_processor.py +0 -35
- msprobe/core/compare/highlight.py +0 -390
- msprobe/core/data_dump/data_collector.py +0 -356
- msprobe/core/grad_probe/constant.py +0 -90
- msprobe/core/grad_probe/grad_compare.py +0 -187
- msprobe/core/grad_probe/utils.py +0 -105
- msprobe/core/kernel_dump/kernel_config.py +0 -33
- msprobe/docs/01.installation.md +0 -250
- msprobe/docs/02.config_introduction.md +0 -221
- msprobe/docs/03.config_examples.md +0 -281
- msprobe/docs/04.kernel_dump_PyTorch.md +0 -73
- msprobe/docs/05.data_dump_PyTorch.md +0 -518
- msprobe/docs/06.data_dump_MindSpore.md +0 -618
- msprobe/docs/07.accuracy_checker_PyTorch.md +0 -310
- msprobe/docs/09.accuracy_checker_MindSpore.md +0 -120
- msprobe/docs/10.accuracy_compare_PyTorch.md +0 -637
- msprobe/docs/11.accuracy_compare_MindSpore.md +0 -769
- msprobe/docs/12.overflow_check_PyTorch.md +0 -82
- msprobe/docs/13.overflow_check_MindSpore.md +0 -33
- msprobe/docs/14.data_parse_PyTorch.md +0 -282
- msprobe/docs/15.free_benchmarking_PyTorch.md +0 -169
- msprobe/docs/16.free_benchmarking_MindSpore.md +0 -159
- msprobe/docs/17.grad_probe.md +0 -205
- msprobe/docs/18.online_dispatch.md +0 -89
- msprobe/docs/19.monitor.md +0 -753
- msprobe/docs/20.monitor_performance_baseline.md +0 -52
- msprobe/docs/21.visualization_PyTorch.md +0 -519
- msprobe/docs/22.visualization_MindSpore.md +0 -515
- msprobe/docs/23.generate_operator_PyTorch.md +0 -107
- msprobe/docs/24.code_mapping_Mindspore.md +0 -29
- msprobe/docs/25.tool_function_introduction.md +0 -29
- msprobe/docs/26.data_dump_PyTorch_baseline.md +0 -48
- msprobe/docs/27.dump_json_instruction.md +0 -795
- msprobe/docs/28.debugger_save_instruction.md +0 -288
- msprobe/docs/28.kernel_dump_MindSpore.md +0 -69
- msprobe/docs/29.data_dump_MSAdapter.md +0 -235
- msprobe/docs/30.overflow_check_MSAdapter.md +0 -31
- msprobe/docs/31.config_check.md +0 -107
- msprobe/docs/32.ckpt_compare.md +0 -69
- msprobe/docs/33.generate_operator_MindSpore.md +0 -181
- msprobe/docs/34.RL_collect.md +0 -101
- msprobe/docs/35.nan_analyze.md +0 -73
- msprobe/docs/36.calculation_result_change.md +0 -75
- msprobe/docs/FAQ.md +0 -232
- msprobe/docs/S02.report_free_benchmarking_validation_performance_baseline.md +0 -146
- msprobe/docs/accuracy_checker_MindSpore/accuracy_checker_MindSpore_baseline.md +0 -14
- msprobe/docs/data_dump_MindSpore/data_dump_MindSpore_baseline.md +0 -33
- msprobe/docs/data_dump_MindSpore/dynamic_graph_quick_start_example.md +0 -217
- msprobe/docs/img/BLOOM-7B_1.png +0 -0
- msprobe/docs/img/BLOOM-7B_2.png +0 -0
- msprobe/docs/img/BLOOM-7B_3.png +0 -0
- msprobe/docs/img/BLOOM-7B_4.png +0 -0
- msprobe/docs/img/GPT-3_1.png +0 -0
- msprobe/docs/img/GPT-3_2.png +0 -0
- msprobe/docs/img/GPT-3_3.png +0 -0
- msprobe/docs/img/GPT-3_4.png +0 -0
- msprobe/docs/img/GPT-3_5.png +0 -0
- msprobe/docs/img/GPT-3_6.png +0 -0
- msprobe/docs/img/GPT-3_7.png +0 -0
- msprobe/docs/img/GPT-3_8.png +0 -0
- msprobe/docs/img/YOLOV5S_1.png +0 -0
- msprobe/docs/img/YOLOV5S_2.png +0 -0
- msprobe/docs/img/accuracy_checking_details.png +0 -0
- msprobe/docs/img/accuracy_checking_result.png +0 -0
- msprobe/docs/img/api_precision_compare_details.png +0 -0
- msprobe/docs/img/api_precision_compare_result.png +0 -0
- msprobe/docs/img/auto_analyze_log.png +0 -0
- msprobe/docs/img/compare_result.png +0 -0
- msprobe/docs/img/compare_result_pkl.png +0 -0
- msprobe/docs/img/compare_result_pkl_md5.png.png +0 -0
- msprobe/docs/img/cpu_info.png +0 -0
- msprobe/docs/img/free_benchmark.png +0 -0
- msprobe/docs/img/free_benchmark_framework.png +0 -0
- msprobe/docs/img/grad_probe_image-1.png +0 -0
- msprobe/docs/img/grad_probe_image-2.png +0 -0
- msprobe/docs/img/grad_probe_image-3.png +0 -0
- msprobe/docs/img/grad_probe_image-4.png +0 -0
- msprobe/docs/img/grad_probe_image.png +0 -0
- msprobe/docs/img/merge_result.png +0 -0
- msprobe/docs/img/module_compare.png +0 -0
- msprobe/docs/img/monitor/cpu_info.png +0 -0
- msprobe/docs/img/monitor/step_count_per_record.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/docs/img/save_compare_result_sample.png +0 -0
- msprobe/docs/img/visualization/fuzzy_match_ms.png +0 -0
- msprobe/docs/img/visualization/fuzzy_match_pt.png +0 -0
- msprobe/docs/img/visualization/proxy.png +0 -0
- msprobe/docs/img/visualization/tensorboard_1.png +0 -0
- msprobe/docs/img/visualization/tensorboard_2.png +0 -0
- msprobe/docs/img/visualization/vis_browser_1.png +0 -0
- msprobe/docs/img/visualization/vis_browser_2.png +0 -0
- msprobe/docs/img/visualization/vis_match_info.png +0 -0
- msprobe/docs/img/visualization/vis_precision_info.png +0 -0
- msprobe/docs/img/visualization/vis_search_info.png +0 -0
- msprobe/docs/img/visualization/vis_show_info.png +0 -0
- msprobe/docs/img/visualization/vis_showcase.png +0 -0
- msprobe/docs/img/visualization/vis_unmatch_info.png +0 -0
- msprobe/docs/visualization/GPTModel.png +0 -0
- msprobe/docs/visualization/ParallelMLP.png +0 -0
- msprobe/docs/visualization/layer_mapping_example.md +0 -132
- msprobe/docs/visualization/mapping.png +0 -0
- msprobe/docs/visualization/mapping1.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/1.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/2.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/3.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/4.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/5.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/6.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/7.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/llamafactory-qwen25vl.txt +0 -59
- msprobe/docs/visualization/mindspeed_llamafactoary_img/llamafactory1.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/llamafactory2.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/mindspeed-mm-qwen25vl.txt +0 -80
- msprobe/docs/visualization/mindspeed_llamafactoary_img/mindspeed1.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactoary_img/mindspeed2.png +0 -0
- msprobe/docs/visualization/mindspeed_llamafactory_mapping.md +0 -330
- msprobe/docs/visualization/module_name.png +0 -0
- msprobe/docs/visualization/module_name1.png +0 -0
- msprobe/docs/visualization/no_mapping.png +0 -0
- msprobe/docs/visualization/no_mapping1.png +0 -0
- msprobe/docs/visualization/no_mapping_analyze.png +0 -0
- msprobe/docs/visualization/top_layer.png +0 -0
- msprobe/mindspore/api_accuracy_checker/generate_op_script/op_generator.py +0 -460
- msprobe/mindspore/api_accuracy_checker/generate_op_script/operator_replication.template +0 -2081
- msprobe/mindspore/code_mapping/bind.py +0 -283
- msprobe/mindspore/code_mapping/cmd_parser.py +0 -40
- msprobe/mindspore/code_mapping/graph.py +0 -49
- msprobe/mindspore/code_mapping/graph_parser.py +0 -211
- msprobe/mindspore/code_mapping/main.py +0 -24
- msprobe/mindspore/code_mapping/processor.py +0 -34
- msprobe/mindspore/dym_loader/hook_dynamic_loader.cpp +0 -111
- msprobe/mindspore/dym_loader/hook_dynamic_loader.h +0 -52
- msprobe/mindspore/free_benchmark/api_pynative_self_check.py +0 -257
- msprobe/mindspore/free_benchmark/common/config.py +0 -27
- msprobe/mindspore/free_benchmark/common/handler_params.py +0 -31
- msprobe/mindspore/free_benchmark/common/utils.py +0 -100
- msprobe/mindspore/free_benchmark/data/support_wrap_ops.yaml +0 -638
- msprobe/mindspore/free_benchmark/handler/base_handler.py +0 -105
- msprobe/mindspore/free_benchmark/handler/check_handler.py +0 -55
- msprobe/mindspore/free_benchmark/handler/fix_handler.py +0 -51
- msprobe/mindspore/free_benchmark/handler/handler_factory.py +0 -36
- msprobe/mindspore/free_benchmark/perturbation/add_noise.py +0 -82
- msprobe/mindspore/free_benchmark/perturbation/base_perturbation.py +0 -45
- msprobe/mindspore/free_benchmark/perturbation/bit_noise.py +0 -78
- msprobe/mindspore/free_benchmark/perturbation/exchange_value.py +0 -77
- msprobe/mindspore/free_benchmark/perturbation/improve_precision.py +0 -56
- msprobe/mindspore/free_benchmark/perturbation/no_change.py +0 -27
- msprobe/mindspore/free_benchmark/perturbation/perturbation_factory.py +0 -46
- msprobe/mindspore/free_benchmark/self_check_tool_factory.py +0 -51
- msprobe/mindspore/grad_probe/global_context.py +0 -127
- msprobe/mindspore/grad_probe/grad_analyzer.py +0 -260
- msprobe/mindspore/grad_probe/grad_monitor.py +0 -42
- msprobe/mindspore/grad_probe/grad_stat_csv.py +0 -161
- msprobe/mindspore/grad_probe/hook.py +0 -115
- msprobe/mindspore/grad_probe/utils.py +0 -43
- msprobe/mindspore/mindtorch/__init__.py +0 -18
- msprobe/mindspore/ms_config.py +0 -153
- msprobe/mindspore/task_handler_factory.py +0 -44
- msprobe/nan_analyze/__init__.py +0 -14
- msprobe/pytorch/api_accuracy_checker/generate_op_script/config_op.json +0 -9
- msprobe/pytorch/api_accuracy_checker/generate_op_script/op_generator.py +0 -480
- msprobe/pytorch/api_accuracy_checker/generate_op_script/operator_replication.template +0 -567
- msprobe/pytorch/debugger/precision_debugger.py +0 -181
- msprobe/pytorch/free_benchmark/__init__.py +0 -23
- msprobe/pytorch/free_benchmark/common/constant.py +0 -85
- msprobe/pytorch/free_benchmark/common/counter.py +0 -87
- msprobe/pytorch/free_benchmark/common/enums.py +0 -80
- msprobe/pytorch/free_benchmark/common/params.py +0 -152
- msprobe/pytorch/free_benchmark/common/utils.py +0 -143
- msprobe/pytorch/free_benchmark/compare/grad_saver.py +0 -215
- msprobe/pytorch/free_benchmark/compare/single_benchmark.py +0 -121
- msprobe/pytorch/free_benchmark/main.py +0 -123
- msprobe/pytorch/free_benchmark/perturbed_layers/base_layer.py +0 -28
- msprobe/pytorch/free_benchmark/perturbed_layers/layer_factory.py +0 -56
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/add_noise.py +0 -107
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/bit_noise.py +0 -121
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/change_value.py +0 -89
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/improve_precision.py +0 -87
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/no_change.py +0 -43
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/npu_base_layser.py +0 -60
- msprobe/pytorch/free_benchmark/perturbed_layers/run_cpu.py +0 -34
- msprobe/pytorch/free_benchmark/result_handlers/base_handler.py +0 -252
- msprobe/pytorch/free_benchmark/result_handlers/check_handler.py +0 -54
- msprobe/pytorch/free_benchmark/result_handlers/fix_handler.py +0 -40
- msprobe/pytorch/free_benchmark/result_handlers/handler_factory.py +0 -45
- msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py +0 -181
- msprobe/pytorch/grad_probe/__init__.py +0 -0
- msprobe/pytorch/grad_probe/grad_monitor.py +0 -108
- msprobe/pytorch/grad_probe/grad_stat_csv.py +0 -160
- msprobe/pytorch/hook_module/__init__.py +0 -16
- msprobe/pytorch/hook_module/wrap_aten.py +0 -111
- msprobe/pytorch/online_dispatch/__init__.py +0 -19
- msprobe/pytorch/online_dispatch/compare.py +0 -224
- msprobe/pytorch/online_dispatch/dispatch.py +0 -332
- msprobe/pytorch/online_dispatch/dump_compare.py +0 -179
- msprobe/pytorch/online_dispatch/single_compare.py +0 -412
- msprobe/pytorch/online_dispatch/torch_ops_config.yaml +0 -58
- msprobe/pytorch/online_dispatch/utils.py +0 -158
- msprobe/pytorch/parse_tool/__init__.py +0 -0
- msprobe/pytorch/parse_tool/cli.py +0 -31
- msprobe/pytorch/parse_tool/lib/__init__.py +0 -0
- msprobe/pytorch/parse_tool/lib/compare.py +0 -253
- msprobe/pytorch/parse_tool/lib/config.py +0 -50
- msprobe/pytorch/parse_tool/lib/file_desc.py +0 -45
- msprobe/pytorch/parse_tool/lib/interactive_cli.py +0 -97
- msprobe/pytorch/parse_tool/lib/parse_exception.py +0 -54
- msprobe/pytorch/parse_tool/lib/parse_tool.py +0 -161
- msprobe/pytorch/parse_tool/lib/utils.py +0 -299
- msprobe/pytorch/parse_tool/lib/visualization.py +0 -85
- msprobe/pytorch/pt_config.py +0 -299
- /msprobe/core/{grad_probe → dump}/__init__.py +0 -0
- /msprobe/{mindspore/code_mapping → core/dump/api_dump}/__init__.py +0 -0
- /msprobe/{mindspore/debugger → core/dump/data_dump}/__init__.py +0 -0
- /msprobe/{mindspore/exception_dump → core/dump/data_dump/data_processor}/__init__.py +0 -0
- /msprobe/{mindspore/free_benchmark → core/dump/debugger}/__init__.py +0 -0
- /msprobe/{mindspore/free_benchmark/common → core/dump/kernel_dump}/__init__.py +0 -0
- /msprobe/mindspore/{free_benchmark/handler → dump/debugger}/__init__.py +0 -0
- /msprobe/mindspore/{grad_probe → dump/dump_processor}/__init__.py +0 -0
- /msprobe/mindspore/{overflow_check → dump/exception_dump}/__init__.py +0 -0
- /msprobe/mindspore/{mindtorch → dump/mindtorch}/mindtorch_adaptor.py +0 -0
- /msprobe/{pytorch/api_accuracy_checker/run_ut → mindspore/dump/overflow_check}/__init__.py +0 -0
- /msprobe/{pytorch/debugger → mindspore/monitor}/__init__.py +0 -0
- /msprobe/{pytorch/free_benchmark/common → msaccucmp}/__init__.py +0 -0
- /msprobe/pytorch/api_accuracy_checker/{run_ut → acc_check}/.keep +0 -0
- /msprobe/pytorch/{free_benchmark/perturbed_layers → api_accuracy_checker/acc_check}/__init__.py +0 -0
- /msprobe/pytorch/api_accuracy_checker/{run_ut → acc_check}/torch_ut_setting.json +0 -0
- /msprobe/pytorch/{free_benchmark/perturbed_layers/npu → dump/api_dump}/__init__.py +0 -0
- /msprobe/pytorch/{hook_module → dump/api_dump}/support_wrap_ops.yaml +0 -0
- /msprobe/pytorch/{free_benchmark/result_handlers → dump/debugger}/__init__.py +0 -0
|
@@ -1,637 +0,0 @@
|
|
|
1
|
-
# PyTorch 场景的精度比对
|
|
2
|
-
|
|
3
|
-
## 🚨 重要通知
|
|
4
|
-
|
|
5
|
-
**1. 精度比对操作中2.2比对函数方式(compare 函数、compare_distributed 函数)将于2025.9.30废弃。**
|
|
6
|
-
|
|
7
|
-
**2. 精度比对已支持自动识别stack.json并呈现NPU_Stack_Info。命令行方式中用户可无需配置compare.json中的"stack_path"字段和命令行中的-s参数。具体使用参见“2.1.4 比对文件”中的参数说明。命令行方式中的-s(--stack_mode)将于2025.9.30废弃,并且不再需要配置compare.json中的"stack_path"字段。比对函数方式同理,详见“2.2.1 compare函数”和“2.2.2 compare_distributed函数”中的参数说明。**
|
|
8
|
-
|
|
9
|
-
## 1 简介
|
|
10
|
-
|
|
11
|
-
- 本节主要介绍通过命令行和比对函数的方式进行 CPU 或 GPU 与 NPU 的精度数据比对,执行精度比对操作前需要先完成 CPU 或 GPU 与 NPU 的精度数据 dump,参见 [PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节。
|
|
12
|
-
|
|
13
|
-
- msprobe 使用子命令 compare 进行比对,可支持单卡和多卡场景的精度数据比对。
|
|
14
|
-
|
|
15
|
-
- 比对函数均通过单独创建精度比对脚本执行,可支持单卡和多卡场景的精度数据比对。
|
|
16
|
-
|
|
17
|
-
- 工具性能:比对数据量较小时(单份文件小于 10 GB),比对速度 0.1 GB/s;比对数据量较大时,比对速度 0.3 GB/s。 推荐环境配置:独占环境,CPU 核心数 192,固态硬盘(IO 速度参考:固态硬盘 > 500 MB/s,机械硬盘 60 ~ 170 MB/s)。用户环境性能弱于标准约束或非独占使用的比对速度酌情向下浮动。比对速度的计算方式:两份比对文件大小/比对耗时。
|
|
18
|
-
|
|
19
|
-
**使用场景**
|
|
20
|
-
|
|
21
|
-
- 同一模型,从 CPU 或 GPU 移植到 NPU 中存在精度下降问题,对比 NPU 芯片中的 API 计算数值与 CPU 或 GPU 芯片中的 API 计算数值,进行问题定位。
|
|
22
|
-
- 同一模型,进行迭代(模型、框架版本升级或设备硬件升级)时存在的精度下降问题,对比相同模型在迭代前后版本的 API 计算数值,进行问题定位。
|
|
23
|
-
- 以上两个场景下,当存在无法自动匹配的API和模块时,则通过用户手动指定可以比对的API或模块来自定义映射关系,进行比对。
|
|
24
|
-
|
|
25
|
-
**注意事项**
|
|
26
|
-
|
|
27
|
-
- NPU 自研 API,在 CPU 或 GPU 侧若没有对应的 API,该 API 的 dump 数据不比对。
|
|
28
|
-
- NPU 与 CPU 或 GPU 的计算结果误差可能会随着模型的执行不断累积,最终会出现同一个 API 因为输入的数据差异较大而无法比对的情况。
|
|
29
|
-
- CPU 或 GPU 与 NPU 中两个相同的 API 会因为调用次数不同导致无法比对或比对到错误的 API,不影响整体运行,该 API 忽略。
|
|
30
|
-
|
|
31
|
-
**API 匹配条件**
|
|
32
|
-
|
|
33
|
-
进行精度比对时,需要判断 CPU 或 GPU 的 API 与 NPU 的 API 是否可以比对,须满足以下匹配条件:
|
|
34
|
-
|
|
35
|
-
- 两个 API 的名称相同,API 命名规则:`{api_type}.{api_name}.{api调用次数}.{正反向}.{输入输出}.{index}`,如:Functional.conv2d.1.backward.input.0。
|
|
36
|
-
- 两个 API 输入输出的 Tensor 数量相同且各个 Tensor 的 Shape 相同。
|
|
37
|
-
|
|
38
|
-
通常满足以上两个条件,工具就认为是同一个 API,成功进行 API 的匹配,后续进行相应的计算。
|
|
39
|
-
|
|
40
|
-
## 2 精度比对操作指导
|
|
41
|
-
|
|
42
|
-
### 2.1 命令行方式
|
|
43
|
-
|
|
44
|
-
#### 2.1.1 比对命令说明
|
|
45
|
-
|
|
46
|
-
命令示例:
|
|
47
|
-
|
|
48
|
-
```shell
|
|
49
|
-
msprobe -f pytorch compare -i ./compare.json -o ./output -s
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
完整参数说明:
|
|
53
|
-
|
|
54
|
-
| 参数名 | 说明 | 是否必选 |
|
|
55
|
-
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
56
|
-
| -f 或 --framework | 指定训练框架,当前场景配置为pytorch。 | 是 |
|
|
57
|
-
| -i 或 --input_path | 指定[比对文件](#51-比对文件),str 类型。 | 是 |
|
|
58
|
-
| -o 或 --output_path | 配置比对结果文件存盘目录,str 类型,默认在当前目录创建output目录。文件名称基于时间戳自动生成,格式为:`compare_result_{timestamp}.xlsx`。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 否 |
|
|
59
|
-
| -s 或 --stack_mode | 比对结果展示调用栈信息(NPU_Stack_Info)的开关,bool 类型。单卡场景开启时,根据[比对文件](#51-比对文件)的参数说明配置stack_path;多卡场景开启时,自动识别npu_dump目录下stack.json文件,如存在生成详细调用栈信息,否则不生成,此参数不生效。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
60
|
-
| -c 或 --compare_only | 仅比对开关,bool 类型。该参数默认未配置,会启用自动精度分析,工具自动针对比对结果进行分析,识别到第一个精度可能不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 `advisor_{timestamp}.txt` 文件)。通过配置该参数取消自动精度分析,仅输出比对结果表格。 | 否 |
|
|
61
|
-
| -f 或 --fuzzy_match | 模糊匹配,bool 类型。开启后,对于网络中同一层级且命名仅调用次数不同的 API,可匹配并进行比对。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
62
|
-
| -hl 或 --highlight | 高亮颜色标记。开启后,比对结果件中通过红色或黄色标记精度可疑API或模块。通过直接配置该参数开启,默认未配置,表示关闭。 开启高亮颜色标记后,比对性能降低,如果比对结果行数超出excel单页限制,程序强制关闭高亮颜色标记。 | 否 |
|
|
63
|
-
| -dm 或 --data_mapping | 自定义映射关系比对。需要指定自定义映射文件*.yaml。自定义映射文件的格式请参见[自定义映射文件](#52-自定义映射文件)。仅[API和模块无法自动匹配场景](#213-api和模块无法自动匹配场景)需要配置。仅支持逐卡比对,即使用[比对文件](#51-比对文件)的单卡场景示例。 | 否 |
|
|
64
|
-
| -da 或 --diff_analyze | 自动识别网络中首差异节点,支持md5、统计量等dump数据。支持单卡/多卡场景。 | 否 |
|
|
65
|
-
|
|
66
|
-
#### 2.1.2 整网比对场景
|
|
67
|
-
|
|
68
|
-
整网比对场景是包含:CPU 或 GPU 与 NPU环境的 API 计算数值的整网数据比对;相同模型不同迭代版本的 API 计算数值的整网数据比对。
|
|
69
|
-
|
|
70
|
-
支持单卡和多卡,可同时比对多卡的 dump 数据。多机场景需要每个设备单独执行比对操作。
|
|
71
|
-
|
|
72
|
-
1. 参见 [PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节完成 CPU 或 GPU 与 NPU 的精度数据 dump。
|
|
73
|
-
|
|
74
|
-
2. 创建[比对文件](#51-比对文件)。
|
|
75
|
-
|
|
76
|
-
3. 运行命令:
|
|
77
|
-
|
|
78
|
-
```shell
|
|
79
|
-
msprobe -f pytorch compare -i ./compare.json -o ./output -s
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
4. 查看比对结果,请参见 [3 精度比对结果分析](#3-精度比对结果分析)。
|
|
83
|
-
|
|
84
|
-
#### 2.1.3 API和模块无法自动匹配场景
|
|
85
|
-
|
|
86
|
-
当存在无法自动匹配的API和模块时,则用户可以通过提供自定义映射关系的配置文件来告知工具可匹配的API或模块,进行比对。
|
|
87
|
-
|
|
88
|
-
1. [config.json](../config.json)文件level配置为L0或L1、task配置为tensor或statistics并指定需要dump的API或模块名。
|
|
89
|
-
|
|
90
|
-
2. 参见[PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节完成 CPU 或 GPU 与 NPU 的精度数据 dump。
|
|
91
|
-
|
|
92
|
-
3. 创建[比对文件](#51-比对文件)(单卡场景示例)。
|
|
93
|
-
|
|
94
|
-
4. 运行命令:
|
|
95
|
-
|
|
96
|
-
```shell
|
|
97
|
-
msprobe -f pytorch compare -i ./compare.json -o ./output -s -dm data_mapping.yaml
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
data_mapping.yaml文件配置请参见[自定义映射文件](#52-自定义映射文件)。
|
|
101
|
-
|
|
102
|
-
该场景不支持-f模糊匹配。
|
|
103
|
-
|
|
104
|
-
5. 查看比对结果,请参见 [3 精度比对结果分析](#3-精度比对结果分析)。
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
#### 2.1.4 单点数据比对场景
|
|
108
|
-
|
|
109
|
-
单点数据比对场景是指:CPU 或 GPU 与 NPU环境的网络中单点保存的数据比对。
|
|
110
|
-
|
|
111
|
-
支持单卡和多卡,可同时比对多卡的单点数据。多机场景需要每个设备单独执行比对操作。
|
|
112
|
-
|
|
113
|
-
1. 参见 [单点保存工具](./28.debugger_save_instruction.md)章节完成 CPU 或 GPU 与 NPU 的单点数据采集。
|
|
114
|
-
|
|
115
|
-
2. 创建[比对文件(单点数据)](#53-比对文件单点数据)。
|
|
116
|
-
|
|
117
|
-
3. 运行命令:
|
|
118
|
-
|
|
119
|
-
```shell
|
|
120
|
-
msprobe -f pytorch compare -i ./compare.json -o ./output
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
4. 查看比对结果,请参见 [3 精度比对结果分析](#3-精度比对结果分析)。
|
|
124
|
-
|
|
125
|
-
#### 2.1.5 首差异算子节点识别场景
|
|
126
|
-
|
|
127
|
-
首差异算子节点识别场景是指:XPU与NPU环境的网络中通过 `msprobe dump`保存数据的数据分析,找到网络精度问题中出现的首个差异算子节点。
|
|
128
|
-
|
|
129
|
-
支持单卡和多卡,可同时比对多卡的dump数据。
|
|
130
|
-
|
|
131
|
-
执行步骤:
|
|
132
|
-
|
|
133
|
-
1. [config.json](../config.json)文件level配置为L0或L1、task配置为tensor或statistics(也可设置 `summary_mode`为 `md5`)并指定需要dump的API或模块名。
|
|
134
|
-
2. 参见[PyTorch 场景下的数据采集](./05.data_dump_PyTorch.md)章节完成 CPU 或 GPU 与 NPU 的精度数据 dump。
|
|
135
|
-
3. 创建[比对文件](#51-比对文件)。
|
|
136
|
-
4. 运行命令:
|
|
137
|
-
|
|
138
|
-
```shell
|
|
139
|
-
msprobe -f pytorch compare -i ./compare.json -o ./output -da
|
|
140
|
-
```
|
|
141
|
-
5. 查看比对结果,在用户指定输出目录下会生成`compare_result_rank{rank_id}_{timestamp}.json`以及`diff_analyze_{timestamp}.json`。
|
|
142
|
-
- 目录结构:
|
|
143
|
-
```
|
|
144
|
-
output/
|
|
145
|
-
├── compare_result_rank0_{timestamp}.json
|
|
146
|
-
├── compare_result_rank1_{timestamp}.json
|
|
147
|
-
├── diff_analyze_{timestamp}.json
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
- `compare_result_rank{rank_id}_{timestamp}.json`:包含该rank比对结果,包括API或模块名、比对状态、比对指标等。
|
|
151
|
-
- `diff_analyze_{timestamp}.json`:包含首差异算子节点识别结果,包括算子节点名、算子类型、算子位置等。
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
### 2.2 比对函数方式
|
|
155
|
-
|
|
156
|
-
#### 2.2.1 compare 函数
|
|
157
|
-
|
|
158
|
-
此函数将 CPU 或 GPU 与 NPU 的 dump 文件进行比对,仅支持单机单卡。
|
|
159
|
-
|
|
160
|
-
**函数原型**:
|
|
161
|
-
|
|
162
|
-
```Python
|
|
163
|
-
compare(input_param, output_path, stack_mode=False, auto_analyze=True, fuzzy_match=False)
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**参数说明**:
|
|
167
|
-
|
|
168
|
-
| 参数名 | 说明 | 是否必选 |
|
|
169
|
-
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
170
|
-
| 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。 | 是 |
|
|
171
|
-
| output_path | 配置比对结果文件存盘目录,str 类型。<br/>**配置示例**:'./output'。文件名称基于时间戳自动生成,格式为:`compare_result_{timestamp}.xlsx`。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 是 |
|
|
172
|
-
| stack_mode | 配置 stack_mode 的开关,bool 类型。仅当配置 stack_json_path 时需要,开启时比对结果呈现NPU_Stack_Info,关闭时不呈现。当不配置stack_json_path 时,自动识别是否存在stack.json,存在时呈现NPU_Stack_Info,否则不呈现。<br/>**配置示例**:stack_mode=True,默认为 False。 | 否 |
|
|
173
|
-
| auto_analyze | 自动精度分析,bool 类型。开启后工具自动针对比对结果进行分析,识别到第一个精度可能不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 advisor_{timestamp}.txt 文件)。<br/>**配置示例**:auto_analyze=False,默认为 True。 | 否 |
|
|
174
|
-
| fuzzy_match | 模糊匹配,bool 类型。开启后,对于网络中同一层级且命名仅调用次数不同的 API,可匹配并进行比对。<br/>**配置示例**:fuzzy_match=True,默认为 False。 | 否 |
|
|
175
|
-
| highlight | 高亮颜色标记。开启后,比对结果件中通过红色或黄色标记精度可疑API或模块。 开启高亮颜色标记后,比对性能降低,如果比对结果行数超出excel单页限制,程序强制关闭高亮颜色标记。<br/>**配置示例**:highlight=True,默认为 False。 | 否 |
|
|
176
|
-
|
|
177
|
-
**函数示例**:
|
|
178
|
-
|
|
179
|
-
单机单卡场景下创建比对脚本,例如 compare.py,拷贝如下代码,具体参数请根据实际环境修改。
|
|
180
|
-
|
|
181
|
-
```Python
|
|
182
|
-
from msprobe.pytorch import compare
|
|
183
|
-
input_param={
|
|
184
|
-
"npu_json_path": "./npu_dump/dump.json",
|
|
185
|
-
"bench_json_path": "./bench_dump/dump.json",
|
|
186
|
-
"stack_json_path": "./npu_dump/stack.json",
|
|
187
|
-
"is_print_compare_log": True
|
|
188
|
-
}
|
|
189
|
-
compare(input_param, output_path="./output", stack_mode=True)
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
#### 2.2.2 compare_distributed 函数
|
|
193
|
-
|
|
194
|
-
此函数将 CPU 或 GPU 与 NPU 的 dump 文件进行比对,支持单卡和多卡,可同时比对多卡的 dump 数据。多机场景需要每个设备单独执行比对操作。可自动检索和匹配对应卡和进程所 dump 的数据文件,再调用 compare 进行比对。单机单卡时与 compare 函数二选一。
|
|
195
|
-
|
|
196
|
-
**函数原型**:
|
|
197
|
-
|
|
198
|
-
```Python
|
|
199
|
-
compare_distributed(npu_dump_dir, bench_dump_dir, output_path, **kwargs)
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**参数说明**:
|
|
203
|
-
|
|
204
|
-
| 参数名 | 说明 | 是否必选 |
|
|
205
|
-
| -------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
206
|
-
| npu_dump_dir | 配置 NPU 环境下的 dump 目录。str 类型。dump 数据目录须指定到 step 级。<br/>**配置示例**:'./npu_dump/step0'。 | 是 |
|
|
207
|
-
| bench_dump_dir | 配置 CPU、GPU 或 NPU 环境下的 dump 目录。str 类型。<br/>**配置示例**:'./gpu_dump/step0'。 | 是 |
|
|
208
|
-
| output_path | 配置比对结果文件存盘目录。需要预先创建 output_path 目录。str 类型。<br/>**配置示例**:'./output'。文件名称基于时间戳自动生成,格式为:`compare_result_rank{npu_ID}_{timestamp}.xlsx`。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 是 |
|
|
209
|
-
| **kwargs | 支持 compare 的所有可选参数。 其中,stack_mode不生效,自动识别是否存在stack.json,如存在,呈现NPU_Stack_Info,否则不呈现。 | 否 |
|
|
210
|
-
|
|
211
|
-
**函数示例**:
|
|
212
|
-
|
|
213
|
-
```Python
|
|
214
|
-
from msprobe.pytorch import *
|
|
215
|
-
compare_distributed('./npu_dump/step0', './gpu_dump/step0', './output')
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
## 3 精度比对结果分析
|
|
219
|
-
|
|
220
|
-
PyTorch 精度比对是以 CPU 或 GPU 的计算结果为标杆,通过计算精度评价指标判断 API 在运行时是否存在精度问题。
|
|
221
|
-
|
|
222
|
-
- `advisor_{timestamp}.txt` 文件中给出了可能存在精度问题的 API 的专家建议。
|
|
223
|
-
|
|
224
|
-
- `compare_result_{timestamp}.xlsx` 文件列出了所有执行精度比对的 API 详细信息和比对结果,示例如下:
|
|
225
|
-
|
|
226
|
-

|
|
227
|
-
|
|
228
|
-
- **提示**:比对结果通过颜色标记、比对结果(Result)、计算精度达标情况(Accuracy Reached no Not)、错误信息提示(Err_Message)定位可疑算子,但鉴于每种指标都有对应的判定标准,还需要结合实际情况进行判断。
|
|
229
|
-
|
|
230
|
-
### 3.1 指标说明
|
|
231
|
-
|
|
232
|
-
精度比对从三个层面评估 API 的精度,依次是:真实数据模式、统计数据模式和 MD5 模式。比对结果分别有不同的表头。
|
|
233
|
-
|
|
234
|
-
**公共表头**:
|
|
235
|
-
|
|
236
|
-
|dump 数据模式|NPU Name (NPU 的 API 名)|Bench Name (bench 的 API 名)|NPU Dtype (NPU 数据类型)|Bench Dtype (bench 数据类型)|NPU Tensor Shape (NPU 张量形状)|Bench Tensor Shape (bench 张量形状)| NPU Requires_grad (NPU tensor是否计算梯度) | Bench Requires_grad (Bench tensor是否计算梯度) |
|
|
237
|
-
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:------------------------------------:|:----------------------------------------:|
|
|
238
|
-
|真实数据模式|√|√|√|√|√|√| √ | √ |
|
|
239
|
-
|统计数据模式|√|√|√|√|√|√| √ | √ |
|
|
240
|
-
|MD5 模式|√|√|√|√|√|√| √ | √ |
|
|
241
|
-
|
|
242
|
-
**个性表头**:
|
|
243
|
-
|
|
244
|
-
统计量有 4 种:最大值(max)、最小值(min)、平均值(mean)和 L2-范数(L2 norm)。
|
|
245
|
-
|
|
246
|
-
|dump 数据模式|Cosine (tensor 余弦相似度)|EucDist (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 值)| Requires_grad Consistent (计算梯度是否一致) | Result (比对结果) |Accuracy Reached or Not (计算精度是否达标)|Err_message (错误信息提示)|NPU_Stack_Info (堆栈信息)| Data_Name ([NPU真实数据名,Bench真实数据名]) |
|
|
247
|
-
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:-----------------------------------:|:-------------:|:---:|:---:|:---:|:---------------------------------:|
|
|
248
|
-
|真实数据模式|√|√|√|√|√|√|||√||| √ | |√|√|√| √ |
|
|
249
|
-
|统计数据模式|||||||√|√|√||| √ | √ ||√|√| |
|
|
250
|
-
|MD5 模式||||||||||√|√| √ | √ |||√| |
|
|
251
|
-
|
|
252
|
-
上表中NPU_Stack_Info字段需要配置-s参数生成。
|
|
253
|
-
|
|
254
|
-
### 3.2 比对指标计算公式
|
|
255
|
-
|
|
256
|
-
$N$: NPU侧tensor
|
|
257
|
-
|
|
258
|
-
$B$: Bench侧tensor
|
|
259
|
-
|
|
260
|
-
RE(Relative Error, 相对误差): $\vert\frac {N-B} {B}\vert$
|
|
261
|
-
|
|
262
|
-
真实数据模式:
|
|
263
|
-
|
|
264
|
-
Cosine: $\frac {{N}\cdot{B}} {{\vert\vert{N}\vert\vert}_2{\vert\vert{B}\vert\vert}_2}$
|
|
265
|
-
|
|
266
|
-
EucDist: ${\vert\vert{A-B}\vert\vert}_2$
|
|
267
|
-
|
|
268
|
-
MaxAbsErr: $max(\vert{N-B}\vert)$
|
|
269
|
-
|
|
270
|
-
MaxRelativeErr: $max(RE)$
|
|
271
|
-
|
|
272
|
-
One Thousandth Err Ratio: $\frac {\sum\mathbb{I}(RE<0.001)} {size(RE)}$
|
|
273
|
-
|
|
274
|
-
Five Thousandth Err Ratio: $\frac {\sum\mathbb{I}(RE<0.005)} {size(RE)}$
|
|
275
|
-
|
|
276
|
-
统计数据模式:
|
|
277
|
-
|
|
278
|
-
Max diff: $max(N)-max(B)$
|
|
279
|
-
|
|
280
|
-
Min diff: $min(N)-min(B)$
|
|
281
|
-
|
|
282
|
-
Mean diff: $mean(N)-mean(B)$
|
|
283
|
-
|
|
284
|
-
L2 Norm diff: $l2norm(N)-l2norm(B)$
|
|
285
|
-
|
|
286
|
-
MaxRelativeErr: $\vert\frac{max(N)-max(B)}{max(B)}\vert*100\%$
|
|
287
|
-
|
|
288
|
-
MinRelativeErr: $\vert\frac{min(N)-min(B)}{min(B)}\vert*100\%$
|
|
289
|
-
|
|
290
|
-
MeanRelativeErr: $\vert\frac{mean(N)-mean(B)}{mean(B)}\vert*100\%$
|
|
291
|
-
|
|
292
|
-
NormRelativeErr: $\vert\frac{l2norm(N)-l2norm(B)}{l2norm(B)}\vert*100\%$
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
### 3.3 颜色标记——真实数据模式、统计数据模式
|
|
296
|
-
|
|
297
|
-
通过在命令行中配置-hl或--highlight开启,或者在比对函数中配置参数highlight=True开启,用于标记精度可疑API或模块。开启后,比对性能会有降低,建议比对较大dump.json文件时不配置此参数。
|
|
298
|
-
颜色标记分为红色标记和黄色标记,红色标记优先级高于黄色标记。
|
|
299
|
-
在比对结果中的Err_message列呈现比对结果颜色标记的原因,具体含义如下:
|
|
300
|
-
|
|
301
|
-
红色标记情况:
|
|
302
|
-
1. 一个 API 或模块的 NPU 的最大值或最小值中存在 nan/inf/-inf(真实数据模式、统计数据模式);
|
|
303
|
-
2. 一个 API 或模块的最大值绝对误差大于 1e+10(真实数据模式,统计数据模式);
|
|
304
|
-
3. 一个 API 或模块的 One Thousandth Err Ratio 的 input/parameters > 0.9 同时 output < 0.6(真实数据模式)(仅标记output);
|
|
305
|
-
4. 一个 API 或模块的 output 的最大值相对误差 (Max diff 除以 max(0.01, Bench max)) > 0.5(统计数据模式)(仅标记output)。
|
|
306
|
-
|
|
307
|
-
黄色标记情况(1-4仅标记output,5无限制):
|
|
308
|
-
1. 一个 API 或模块的 input/parameters 与 output 的最大值绝对误差都大于 1,同时 output 比 input/parameters 大一个数量级以上(真实数据模式、统计数据模式);
|
|
309
|
-
2. 一个 API 或模块的 One Thousandth Err Ratio 的 input/parameters - output > 0.1(真实数据模式);
|
|
310
|
-
3. 一个 API 或模块的 output 的最大值相对误差 > 0.1 同时 input/parameters < 0.01(真实数据模式,统计数据模式);
|
|
311
|
-
4. 一个 API 或模块的 Cosine 的 input/parameters - output > 0.1(真实数据模式);
|
|
312
|
-
5. 一个 API 或模块的 Requires_grad Consistent 为 False。
|
|
313
|
-
|
|
314
|
-
### 3.4 比对结果(Result)——统计数据模式、MD5 模式
|
|
315
|
-
|
|
316
|
-
统计数据模式:
|
|
317
|
-
1. Warning 情况:4种统计值至少一种相对误差 > 0.5,要重点检查该 API;
|
|
318
|
-
2. 空情况:相对误差 ≤ 0.5,可以不需要重点关注,但不代表不存在精度问题;
|
|
319
|
-
3. N/A 情况:API 没有匹配上。
|
|
320
|
-
|
|
321
|
-
MD5 模式:
|
|
322
|
-
1. Pass 情况:NPU 与标杆的 CRC-32 值一致,即 API 数据完全一致;
|
|
323
|
-
2. Different 情况:NPU 与标杆的 CRC-32 值不一致,即 API 数据不完全一致;
|
|
324
|
-
3. N/A 情况:API 没有匹配上。
|
|
325
|
-
|
|
326
|
-
### 3.5 判断计算精度达标情况(Accuracy Reached or Not)——真实数据模式
|
|
327
|
-
|
|
328
|
-
标记为 `No`,表示精度不达标:
|
|
329
|
-
1. Cosine < 0.99 且 MaxAbsError > 0.001;
|
|
330
|
-
2. Cosine < 0.9;
|
|
331
|
-
3. MaxAbsError > 1;
|
|
332
|
-
4. Cosine 或 MaxAbsError 计算结果为 N/A(NPU 和 Bench 的数据有 nan/inf)。
|
|
333
|
-
|
|
334
|
-
标记为 `None`:
|
|
335
|
-
1. Cosine 或 MaxAbsError 计算结果为 None(读取到的数据为空);
|
|
336
|
-
2. Cosine 或 MaxAbsError 计算结果无法转换为浮点型。
|
|
337
|
-
|
|
338
|
-
标记为 `Unmatched`:
|
|
339
|
-
1. Cosine 计算结果为 `shape unmatched`(NPU 和 Bench 的数据结构不一致)。
|
|
340
|
-
|
|
341
|
-
标记为 `Yes`,表示精度达标:
|
|
342
|
-
1. 除以上情况外的其余情况。
|
|
343
|
-
|
|
344
|
-
### 3.6 错误信息提示(Err_message)——真实数据模式、统计数据模式
|
|
345
|
-
|
|
346
|
-
1. "Need double check api accuracy.":四个统计值中至少 1 个相对误差 > 0.5(统计数据模式);
|
|
347
|
-
2. "Fuzzy matching data, the comparison accuracy may be affected.":NPU 或 Bench 的真实数据名没有匹配上(真实数据模式);
|
|
348
|
-
3. "Dump file: {} not found or read failed.":NPU 或 Bench 的真实数据者读取出错(真实数据模式);
|
|
349
|
-
4. "No bench data matched.":Bench 的 API 没有匹配上(真实数据模式,统计数据模式);
|
|
350
|
-
5. "NPU does not have data file.": NPU的真实数据不存在(真实数据模式);
|
|
351
|
-
6. "Bench does not have data file.": Bench的真实数据不存在(真实数据模式);
|
|
352
|
-
7. "Bench api/module unmatched.":Bench 的 API 没有匹配上(真实数据模式);
|
|
353
|
-
8. "This is empty data, can not compare.":读取到的数据为空(真实数据模式);
|
|
354
|
-
9. "Shape of NPU and bench Tensor do not match. Skipped.":NPU 和 Bench 的数据结构不一致(真实数据模式);
|
|
355
|
-
10. "The Position of inf or nan in NPU and bench Tensor do not match.":NPU 和 Bench 的数据有 nan/inf(真实数据模式);
|
|
356
|
-
11. "This is type of 0-d tensor, can not calculate 'Cosine', 'EucDist', 'One Thousandth Err Ratio' and 'Five Thousandths Err Ratio'.":NPU 为0维张量(真实数据模式);
|
|
357
|
-
12. "Dtype of NPU and bench Tensor do not match.":NPU 和 Bench 数据的数据类型不同(真实数据模式);
|
|
358
|
-
13. "Requires_grad inconsistent.":NPU 和 Bench 的 Requires_grad 不一致(真实数据模式,统计数据模式);
|
|
359
|
-
14. "":除以上情况的其余情况(真实数据模式、统计数据模式)。
|
|
360
|
-
|
|
361
|
-
除以上错误信息提示外,异常数据颜色高亮标记的原因叠加呈现于此列。
|
|
362
|
-
|
|
363
|
-
### 3.7 计算精度评价指标分析
|
|
364
|
-
|
|
365
|
-
1. Cosine:通过计算两个向量的余弦值来判断其相似度,数值越接近于 1 说明计算出的两个张量越相似,实际可接受阈值为大于 0.99。在计算中可能会存在 nan,主要由于可能会出现其中一个向量为 0。
|
|
366
|
-
|
|
367
|
-
2. EucDist:通过计算两个向量的欧式距离来判断其相似度,定义为多维空间中两个点之间的绝对距离。数值越接近0,张量越相似,数值越大,差异越大。
|
|
368
|
-
|
|
369
|
-
3. MaxAbsErr:当最大绝对误差越接近 0 表示其计算的误差越小,实际可接受阈值为小于 0.001。
|
|
370
|
-
|
|
371
|
-
4. MaxRelativeErr:当最大相对误差越接近 0 表示其计算的误差越小。
|
|
372
|
-
|
|
373
|
-
当 dump 数据中存在 0 或 nan 时,比对结果中最大相对误差则出现 inf 或 nan 的情况,属于正常现象。
|
|
374
|
-
|
|
375
|
-
5. One Thousandth Err Ratio(相对误差小于千分之一的元素比例)、Five Thousandths Err Ratio(相对误差小于千分之五的元素比例)精度指标:是指 NPU 的 Tensor 中的元素逐个与对应的标杆数据对比,相对误差小于千分之一、千分之五的比例占总元素个数的比例。该数据仅作为精度下降趋势的参考,并不参与计算精度是否通过的判定。
|
|
376
|
-
|
|
377
|
-
## 4 多卡比对结果提取汇总通信算子数据
|
|
378
|
-
|
|
379
|
-
本功能是将多卡比对场景的比对结果,进行通信算子数据提取和汇总,输出整理好的通信算子多卡比对精度表。
|
|
380
|
-
|
|
381
|
-
**使用场景**
|
|
382
|
-
|
|
383
|
-
已完成精度比对,获得多卡精度比对结果,但是通信算子数据分布在多个结果件中,不利于精度问题的分析。通过此功能,可以汇总多卡通信算子数据,减少问题定位时间。
|
|
384
|
-
|
|
385
|
-
**约束**
|
|
386
|
-
|
|
387
|
-
不支持MD5比对结果。
|
|
388
|
-
|
|
389
|
-
**命令示例**
|
|
390
|
-
|
|
391
|
-
```bash
|
|
392
|
-
msprobe -f pytorch merge_result -i ./input_dir -o ./output_dir -config ./config.yaml
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
**完整参数说明**
|
|
396
|
-
|
|
397
|
-
| 参数名 | 说明 | 是否必选 |
|
|
398
|
-
| --------------------- |-------------------------------------------------------------------------------------------------------------------| -------- |
|
|
399
|
-
| -f 或 --framework | 指定训练框架,当前场景配置为pytorch。 | 是 |
|
|
400
|
-
| -i 或 --input_dir | 多卡比对结果存盘目录,即使用compare比对的结果输出目录,str类型。所有比对结果应全部为真实数据比对结果或统计数据比对结果,否则可能导致汇总数据不完整。 | 是 |
|
|
401
|
-
| -o 或 --output_dir | 数据提取汇总结果存盘目录,str类型。文件名称基于时间戳自动生成,格式为:`multi_ranks_compare_merge_{timestamp}.xlsx`。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 是 |
|
|
402
|
-
| -config或--config-path | 指定需要汇总数据的API和比对指标的yaml文件路径,str类型。<br>yaml文件详细介绍见下文“**yaml文件说明**”。 | 是 |
|
|
403
|
-
|
|
404
|
-
**yaml文件说明**
|
|
405
|
-
|
|
406
|
-
以config.yaml文件名为例,配置示例如下:
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
api:
|
|
410
|
-
- Distributed.all_reduce
|
|
411
|
-
- Distributed.all_gather_into_tensor
|
|
412
|
-
compare_index:
|
|
413
|
-
- Max diff
|
|
414
|
-
- L2norm diff
|
|
415
|
-
- MeanRelativeErr
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
| 参数名 | 说明 |
|
|
419
|
-
| ------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
420
|
-
| api | 表示需要汇总的API或module名称。如果没有配置,工具会提示报错。<br>api名称配置格式为:`{api_type}.{api_name}.{API调用次数}.{前向反向}`<br>须按顺序配置以上四个字段,可按如下组合配置:<br/> {api_type}<br/> {api_type}.{api_name}<br/> {api_type}.{api_name}.{API调用次数}<br/> {api_type}.{api_name}.{API调用次数}.{前向反向}<br/>这里的api指代API或module。 |
|
|
421
|
-
| compare_index | 表示需要汇总的比对指标。compare_index需为dump_mode对应比对指标的子集。如果没有配置,工具将根据比对结果自动提取dump_mode对应的全部比对指标进行汇总。<br>统计数据模式比对指标:Max diff、Min diff、Mean diff、L2norm diff、MaxRelativeErr、MinRelativeErr、MeanRelativeErr、NormRelativeErr、Requires_grad Consistent<br>真实数据模式比对指标:Cosine、EucDist、MaxAbsErr、MaxRelativeErr、One Thousandth Err Ratio、Five Thousandths Err Ratio、Requires_grad Consistent |
|
|
422
|
-
|
|
423
|
-
**汇总结果件说明**
|
|
424
|
-
|
|
425
|
-
多卡数据汇总结果如下所示:
|
|
426
|
-
|
|
427
|
-

|
|
428
|
-
|
|
429
|
-
1. NPU Name列表示API或module名称。
|
|
430
|
-
2. rank*列为多卡数据。
|
|
431
|
-
3. 不同比对指标的数据通过不同sheet页呈现。
|
|
432
|
-
4. 如果一个API或module在某张卡上找不到数据,汇总结果中将空白呈现。
|
|
433
|
-
5. 如果比对指标值为N/A,unsupported,Nan,表示无法计算该比对指标值,汇总结果将以”NPU:’NPU max值‘ Bench:’Bench max值‘“呈现。
|
|
434
|
-
6. 针对图示案例,此处NPU:N/A Bench:N/A表示output为None。
|
|
435
|
-
|
|
436
|
-
<br>
|
|
437
|
-
如何基于group信息查看分组数据:
|
|
438
|
-
|
|
439
|
-
以Distributed.all_reduce.0.forward为例。这个API将多卡数据规约操作,输出为一个group内的规约结果,同一个group内的输出保持一致。<br>这个API中,rank0-3为一个group,Distributed.all_reduce.0.forward.input.group展示为tp-0-1-2-3,rank0-3输出一致;rank4-7为一个group,展示为tp-4-5-6-7,rank4-7输出一致。<br>group除了这种形式,还有如[0, 1, 2, 3]的呈现形式。
|
|
440
|
-
|
|
441
|
-
<br>
|
|
442
|
-
常见通信API预期结果:
|
|
443
|
-
|
|
444
|
-
1. Distributed.all_gather:多卡数据汇总,每张卡输入可以不一致,同group内输出一致,输出是张量列表。
|
|
445
|
-
2. Distributed.all_gather_into_tensor:多卡数据汇总,每张卡输入可以不一致,同group内输出一致,输出是张量。
|
|
446
|
-
3. Distributed.all_reduce:多卡数据规约操作,每张卡输入可以不一致,同group内输出一致,为规约结果。
|
|
447
|
-
4. Distributed.reduce_scatter:多卡数据规约操作,每张卡输入可以不一致,输出为group内规约结果的不同部分,输入是张量列表。
|
|
448
|
-
5. Distributed.reduce_scatter_tensor:多卡数据规约操作,每张卡输入可以不一致,输出为group内规约结果的不同部分,输入是张量。
|
|
449
|
-
6. Distributed.broadcast:输入为要广播的数据,输出为广播后的数据。
|
|
450
|
-
7. Distributed.isend:点对点通信,输入为要发送的数据,输出为发送的数据。
|
|
451
|
-
8. Distributed.irecv:点对点通信,输入为原数据,输出为接收的新数据。
|
|
452
|
-
9. Distributed.all_to_all_single:输出数据为所有卡上的数据切分后合并的结果。
|
|
453
|
-
|
|
454
|
-
## 5 附录
|
|
455
|
-
|
|
456
|
-
### 5.1 比对文件
|
|
457
|
-
|
|
458
|
-
以在当前目录创建 ./compare.json 为例。
|
|
459
|
-
|
|
460
|
-
- 单卡场景示例:
|
|
461
|
-
|
|
462
|
-
```json
|
|
463
|
-
{
|
|
464
|
-
"npu_path": "./npu_dump/dump.json",
|
|
465
|
-
"bench_path": "./bench_dump/dump.json",
|
|
466
|
-
"stack_path": "./npu_dump/stack.json",
|
|
467
|
-
"is_print_compare_log": true
|
|
468
|
-
}
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
- 多卡场景示例:
|
|
472
|
-
|
|
473
|
-
```json
|
|
474
|
-
{
|
|
475
|
-
"npu_path": "./npu_dump/step0", # 需填写到step层级(rank的上一层级)
|
|
476
|
-
"bench_path": "./bench_dump/step0", # 需填写到step层级(rank的上一层级)
|
|
477
|
-
"is_print_compare_log": true
|
|
478
|
-
}
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
**参数说明**
|
|
482
|
-
|
|
483
|
-
| 参数名 | 说明 | 是否必选 |
|
|
484
|
-
| -------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|
|
|
485
|
-
| npu_path | 配置NPU环境下的dump.json文件(单卡场景)或dump目录(多卡场景)。数据类型:str。 | 是 |
|
|
486
|
-
| bench_path | 配置CPU、GPU或NPU环境下的dump.json文件(单卡场景)或dump目录(多卡场景)。数据类型:str。 | 是 |
|
|
487
|
-
| stack_path | 配置NPU dump目录下的stack.json文件。数据类型:str。如果没有配置stack_path,命令行-s参数不生效,程序自动识别是否存在stack.json文件,如存在,则比对结果中呈现NPU_Stack_Info,如不存在,则不呈现。如果配置了stack_path,比对结果中是否呈现NPU_Stack_Info则通过命令行参数-s来控制。 | 否 |
|
|
488
|
-
| is_print_compare_log | 配置是否开启单个算子的日志打屏。可取值true或false,默认为true。关闭后则只输出常规日志。数据类型:bool。 | 否 |
|
|
489
|
-
|
|
490
|
-
### 5.2 自定义映射文件
|
|
491
|
-
|
|
492
|
-
文件名格式:*.yaml,*为文件名,可自定义。
|
|
493
|
-
|
|
494
|
-
文件内容格式:
|
|
495
|
-
|
|
496
|
-
```yaml
|
|
497
|
-
# API
|
|
498
|
-
{api_type}.{api_name}.{API调用次数}.{前向反向}.{input/output}.{参数序号}: {api_type}.{api_name}.{API调用次数}.{前向反向}.{input/output}.{参数序号}
|
|
499
|
-
# 模块
|
|
500
|
-
{Module}.{module_name}.{前向反向}.{index}.{input/output}.{参数序号}: {Module}.{module_name}.{前向反向}.{index}.{input/output}.{参数序号}
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
冒号左侧和右侧分别为PyTorch框架不同版本或不同芯片环境的API的名称和module模块名称。
|
|
504
|
-
|
|
505
|
-
API和模块名称请从《[PyTorch 场景的精度数据采集](05.data_dump_PyTorch.md)》中的dump.json文件获取。
|
|
506
|
-
|
|
507
|
-
文件内容示例:
|
|
508
|
-
|
|
509
|
-
```yaml
|
|
510
|
-
# API
|
|
511
|
-
NPU.npu_fusion_attention.4.forward.input.0: NPU.npu_fusion_attention.4.forward.input.0
|
|
512
|
-
# 模块
|
|
513
|
-
Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.forward.0.input.0: Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.forward.0.input.0
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
当dump.json文件中存在“data_name”字段时,API和模块名称为data_name字段去掉文件后缀,如下图红框处所示:
|
|
517
|
-
|
|
518
|
-

|
|
519
|
-
|
|
520
|
-
当dump.json文件中不存在“data_name”字段时,名称的拼写规则如下:
|
|
521
|
-
|
|
522
|
-
input_args、input_kwargs和output使用统一的命名规则,当值是list类型时,名称后面添加'.{index}',当值类型是dict类型时,名称后面加'.{key}',当值类型是具体Tensor或null或int或float或bool或空list/dict等时,命名结束。
|
|
523
|
-
|
|
524
|
-
以下面api的dump文件为例:
|
|
525
|
-
```yaml
|
|
526
|
-
"Functional.max_pool2d.0.forward": {
|
|
527
|
-
"input_args": [
|
|
528
|
-
{
|
|
529
|
-
"type": "torch.Tensor",
|
|
530
|
-
"dtype": "torch_float32",
|
|
531
|
-
"shape": [
|
|
532
|
-
1,
|
|
533
|
-
64,
|
|
534
|
-
14,
|
|
535
|
-
14
|
|
536
|
-
],
|
|
537
|
-
"Max": xxx,
|
|
538
|
-
"Min": xxx,
|
|
539
|
-
"Mean": xxx,
|
|
540
|
-
"Norm": xxx,
|
|
541
|
-
"requires_grad": true
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
"type": "int",
|
|
545
|
-
"value": 3
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
"type": "int",
|
|
549
|
-
"value": 2
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
"type": "int",
|
|
553
|
-
"value": 1
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
"type": "int",
|
|
557
|
-
"value": 1
|
|
558
|
-
}
|
|
559
|
-
],
|
|
560
|
-
"input_kwargs": {
|
|
561
|
-
"ceil_mode": {
|
|
562
|
-
"type": "bool",
|
|
563
|
-
"value": false
|
|
564
|
-
},
|
|
565
|
-
"return_indices": {
|
|
566
|
-
"type": "bool",
|
|
567
|
-
"value": false
|
|
568
|
-
},
|
|
569
|
-
},
|
|
570
|
-
"output": [
|
|
571
|
-
{
|
|
572
|
-
"type": "torch.Tensor",
|
|
573
|
-
"dtype": "torch.float32",
|
|
574
|
-
"shape": [
|
|
575
|
-
1,
|
|
576
|
-
64,
|
|
577
|
-
7,
|
|
578
|
-
7
|
|
579
|
-
],
|
|
580
|
-
"Max": xxx,
|
|
581
|
-
"Min": xxx,
|
|
582
|
-
"Mean": xxx,
|
|
583
|
-
"Norm": xxx,
|
|
584
|
-
"requires_grad": true
|
|
585
|
-
}
|
|
586
|
-
]
|
|
587
|
-
}
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
初始名称为Functional.max_pool2d.0.forward,input_args是list,长度为5,第0项后面是Tensor,命名结束;第1-4项后面均是int,命名结束;按照顺序命名为
|
|
591
|
-
```
|
|
592
|
-
Functional.max_pool2d.0.forward.input.0
|
|
593
|
-
Functional.max_pool2d.0.forward.input.1
|
|
594
|
-
Functional.max_pool2d.0.forward.input.2
|
|
595
|
-
Functional.max_pool2d.0.forward.input.3
|
|
596
|
-
Functional.max_pool2d.0.forward.input.4
|
|
597
|
-
```
|
|
598
|
-
input_kwargs是dict,key是ceil_mode、return_indices,值均是bool,命名结束;命名为
|
|
599
|
-
```
|
|
600
|
-
Functional.max_pool2d.0.forward.input.ceil_mode
|
|
601
|
-
Functional.max_pool2d.0.forward.input.return_indices
|
|
602
|
-
```
|
|
603
|
-
output是list,长度为1,第0项后面是Tensor,命名结束;按照顺序命名为
|
|
604
|
-
```
|
|
605
|
-
Functional.max_pool2d.0.forward.output.0
|
|
606
|
-
```
|
|
607
|
-
综上,生成的op_name为
|
|
608
|
-
```
|
|
609
|
-
Functional.max_pool2d.0.forward.input.0
|
|
610
|
-
Functional.max_pool2d.0.forward.input.1
|
|
611
|
-
Functional.max_pool2d.0.forward.input.2
|
|
612
|
-
Functional.max_pool2d.0.forward.input.3
|
|
613
|
-
Functional.max_pool2d.0.forward.input.4
|
|
614
|
-
Functional.max_pool2d.0.forward.input.ceil_mode
|
|
615
|
-
Functional.max_pool2d.0.forward.input.return_indices
|
|
616
|
-
Functional.max_pool2d.0.forward.output.0
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
### 5.3 比对文件(单点数据)
|
|
620
|
-
|
|
621
|
-
- 单卡场景示例:
|
|
622
|
-
|
|
623
|
-
```json
|
|
624
|
-
{
|
|
625
|
-
"npu_path": "./npu_dump/debug.json",
|
|
626
|
-
"bench_path": "./bench_dump/debug.json"
|
|
627
|
-
}
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
- 多卡场景示例(step0目录下包含debug.json文件):
|
|
631
|
-
|
|
632
|
-
```json
|
|
633
|
-
{
|
|
634
|
-
"npu_path": "./npu_dump/step0",
|
|
635
|
-
"bench_path": "./bench_dump/step0"
|
|
636
|
-
}
|
|
637
|
-
```
|