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,769 +0,0 @@
|
|
|
1
|
-
# MindSpore 场景的精度比对
|
|
2
|
-
|
|
3
|
-
## 🚨 重要通知
|
|
4
|
-
|
|
5
|
-
**1. 精度比对已支持自动识别stack.json并呈现NPU_Stack_Info,用户可无需配置compare.json中的"stack_path"字段和命令行中的-s参数。具体使用参见“4.1 比对文件”中的参数说明。命令行方式中的-s(--stack_mode)将于2025.9.30废弃,并且不再需要配置compare.json中的"stack_path"字段。**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## 1 简介
|
|
9
|
-
|
|
10
|
-
msprobe精度比对工具主要用于如下场景:
|
|
11
|
-
|
|
12
|
-
- MindSpore框架内比对
|
|
13
|
-
- 通过对同一个网络模型,在两个不同版本的MindSpore静态图环境下,输入相同的训练数据,在分别得到API dump数据后,对这两个API dump数据进行全量自动比对,从而快速定位不同版本之间的精度问题。
|
|
14
|
-
- 通过对同一个网络模型,在两个不同版本的MindSpore静态图环境下,输入相同的训练数据,在分别得到kernel dump数据后,对这两个kernel dump数据进行全量自动比对,从而快速定位不同版本之间的精度问题。
|
|
15
|
-
- 通过对同一个网络模型,在两个不同版本的MindSpore动态图环境下,输入相同的训练数据,在分别得到cell dump数据后,对这两个cell模块进行全量自动比对,从而快速定位不同版本之间的精度问题。
|
|
16
|
-
- MindSpore与PyTorch跨框架比对
|
|
17
|
-
- 通过对同一个网络模型,在整网环境下分别在MindSpore动态图和PyTorch环境下获得API dump数据,以PyTorch数据作为标杆,进行自动比对,从而实现跨框架的精度对比。
|
|
18
|
-
- 通过对同一个网络模型,在整网环境下分别在MindSpore动态图和PyTorch环境下获得cell dump数据,由用户指定可以比对的cell list,以PyTorch数据作为标杆,进行自动比对,从而实现跨框架的精度对比。
|
|
19
|
-
- 通过对同一个网络模型,在整网环境下分别在MindSpore动态图和PyTorch环境下获得API或模块dump数据,由用户指定可以比对的API或模块,以PyTorch数据作为标杆,进行自动比对,从而实现跨框架的精度对比。
|
|
20
|
-
- 通过对同一个网络模型,在整网环境下分别在MindSpore动态图和PyTorch环境下获得API或模块dump数据,由用户指定可以比对的模型代码中的Layer层,以PyTorch数据作为标杆,进行自动比对,从而实现跨框架的精度对比。
|
|
21
|
-
|
|
22
|
-
执行精度比对操作需要安装msprobe工具。详见[《msprobe 工具安装指南》](./01.installation.md)。
|
|
23
|
-
|
|
24
|
-
## 2 命令行比对
|
|
25
|
-
|
|
26
|
-
精度比对工具目前使用方式为命令行形式。
|
|
27
|
-
|
|
28
|
-
### 2.1 比对命令说明
|
|
29
|
-
|
|
30
|
-
命令示例如下:
|
|
31
|
-
|
|
32
|
-
```shell
|
|
33
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**完整参数说明**
|
|
37
|
-
|
|
38
|
-
| 参数名 | 说明 | 是否必选 |
|
|
39
|
-
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
|
|
40
|
-
| -f 或 --framework | 指定训练框架。mindspore。 | 是 |
|
|
41
|
-
| -i或--input_path | 指定比对文件。比对文件内容及示例请参见[比对文件](#41-比对文件)或[比对文件(kernel)](#42-比对文件kernel)(比对文件(kernel)仅[不同版本下的全量kernel比对](#23-不同版本下的全量kernel比对)场景支持)。 | 是 |
|
|
42
|
-
| -o或--output_path | 配置比对结果文件存盘目录,默认会在当前目录创建output目录。文件名称基于时间戳自动生成,格式为:<br> `compare_result_{timestamp}.xlsx`<br/> `compare_result_{rank_id}_{step_id}_{timestamp}.xlsx`(仅[不同版本下的全量kernel比对](#23-不同版本下的全量kernel比对)场景支持)。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 否 |
|
|
43
|
-
| -s或--stack_mode | 比对结果展示调用栈信息(NPU_Stack_Info)的开关,bool 类型。单卡场景开启时,需要使用[比对文件](#41-比对文件)的单卡场景配置stack_path指定stack.json文件,才能生成详细调用栈信息,否则在比对时会报错;暂不支持多卡场景。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
44
|
-
| -c或--compare_only | 仅比对开关,bool 类型。该参数默认未配置,会启用自动精度分析,工具自动针对比对结果进行分析,识别到第一个精度可能不达标节点(在比对结果文件中的 Accuracy Reached or Not 列显示为 No),并给出问题可能产生的原因(打屏展示并生成 `advisor_{timestamp}.txt` 文件)。通过配置该参数取消自动精度分析,仅输出比对结果表格。 | 否 |
|
|
45
|
-
| -f或--fuzzy_match | 模糊匹配。开启后,对于网络中同一层级且命名仅调用次数不同的API,可匹配并进行比对。通过直接配置该参数开启,默认未配置,表示关闭。 | 否 |
|
|
46
|
-
| -hl或--highlight | 高亮颜色标记。开启后,比对结果件中通过红色或黄色标记精度可疑API或模块。通过直接配置该参数开启,默认未配置,表示关闭。 开启高亮颜色标记后,比对性能降低,如果比对结果行数超出excel单页限制,程序强制关闭高亮颜色标记。 | 否 |
|
|
47
|
-
| -am或--api_mapping | 跨框架比对。配置该参数时表示开启跨框架API比对功能,可以指定自定义映射文件*.yaml,不指定映射文件时按照msprobe定义的默认映射关系进行比对。自定义映射文件的格式请参见[自定义映射文件(api_mapping)](#43-自定义映射文件api_mapping)。仅[跨框架的API比对](#25-跨框架的api比对)场景需要配置。 | 否 |
|
|
48
|
-
| -cm或--cell_mapping | 跨框架比对。配置该参数时表示开启跨框架cell模块比对功能,可以指定自定义映射文件*.yaml,不指定映射文件时按照msprobe定义的默认映射关系进行比对。自定义映射文件的格式请参见[自定义映射文件(cell_mapping)](#44-自定义映射文件cell_mapping)。仅[跨框架的cell模块比对](#26-跨框架的cell模块比对)场景需要配置。 | 否 |
|
|
49
|
-
| -dm或--data_mapping | 同框架或跨框架比对。通过映射文件指定两个具体参数的对应关系,可以在L0、L1或mix采集场景下使用。配置该参数的同时需要指定自定义映射文件*.yaml。自定义映射文件的格式请参见[自定义映射文件(data_mapping)](#45-自定义映射文件data_mapping)。 | 否 |
|
|
50
|
-
| -lm或--layer_mapping | 跨框架比对。配置该参数时表示开启跨框架Layer层的比对功能,指定模型代码中的Layer层后,可以识别对应dump数据中的模块或API。需要指定自定义映射文件*.yaml。自定义映射文件的格式请参见[自定义映射文件(Layer_mapping)](#46-自定义映射文件layer_mapping)。仅[跨框架的Layer层比对](#27-跨框架的layer层比对)场景需要配置。 | 否 |
|
|
51
|
-
| -da或--diff_analyze | 自动识别网络中首差异节点,支持md5、统计量等dump数据。支持单卡/多卡场景。 | 否 |
|
|
52
|
-
|
|
53
|
-
动态图模式没有填写任何mapping时,按照同框架比对的方式进行比对,比对数据和标杆数据的Cell或Api名称需要完全相同才能匹配得上。
|
|
54
|
-
|
|
55
|
-
### 2.2 不同版本下的全量API比对
|
|
56
|
-
|
|
57
|
-
1. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》完成不同环境下MindSpore静态图精度数据的采集,得到不同框架版本的API dump数据。
|
|
58
|
-
|
|
59
|
-
2. 创建比对文件,文件内容及示例请参见[比对文件](#41-比对文件)。
|
|
60
|
-
|
|
61
|
-
3. 执行如下示例命令进行比对:
|
|
62
|
-
|
|
63
|
-
```shell
|
|
64
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
4. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
68
|
-
|
|
69
|
-
### 2.3 不同版本下的全量kernel比对
|
|
70
|
-
|
|
71
|
-
1. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》完成不同环境下MindSpore静态图精度数据的采集,得到不同框架版本的kernel dump数据。
|
|
72
|
-
|
|
73
|
-
2. 创建比对文件,文件内容及示例请参见[比对文件(kernel)](#42-比对文件kernel)。
|
|
74
|
-
|
|
75
|
-
3. 执行如下示例命令进行比对:
|
|
76
|
-
|
|
77
|
-
```shell
|
|
78
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
该场景仅支持compare的-i和-o参数。
|
|
82
|
-
|
|
83
|
-
4. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
84
|
-
|
|
85
|
-
### 2.4 不同版本下的cell模块比对
|
|
86
|
-
|
|
87
|
-
1. 配置[config.json](../config.json)文件level配置为L0、task配置为tensor或statistics并指定需要dump的cell模块名。
|
|
88
|
-
|
|
89
|
-
2. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》完成不同环境下MindSpore动态图精度数据的采集,得到不同框架版本的cell模块dump数据。
|
|
90
|
-
|
|
91
|
-
3. 创建比对文件,文件内容及示例请参见[比对文件](#41-比对文件)。
|
|
92
|
-
|
|
93
|
-
4. 执行如下示例命令进行比对:
|
|
94
|
-
|
|
95
|
-
```shell
|
|
96
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
5. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
100
|
-
|
|
101
|
-
### 2.5 跨框架的API比对
|
|
102
|
-
|
|
103
|
-
1. 配置[config.json](../config.json)文件level配置为L1、task配置为tensor或statistics。
|
|
104
|
-
|
|
105
|
-
2. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》和《[PyTorch 场景的精度数据采集](./05.data_dump_PyTorch.md)》完成不同环境下API精度数据的采集,得到两个框架的API dump数据。
|
|
106
|
-
|
|
107
|
-
3. 创建比对文件,文件内容及示例请参见[比对文件](#41-比对文件)。
|
|
108
|
-
|
|
109
|
-
4. 执行如下示例命令进行比对:
|
|
110
|
-
|
|
111
|
-
```shell
|
|
112
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -am
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
或
|
|
116
|
-
|
|
117
|
-
```shell
|
|
118
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -am api_mapping.yaml
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
api_mapping.yaml文件配置请参见[自定义映射文件(api_mapping)](#43-自定义映射文件api_mapping)。
|
|
122
|
-
不传入api_mapping.yaml的情况下将按照内置的api映射进行匹配;传入api_mapping.yaml的情况下优先按照api_mapping.yaml的内容进行匹配,api_mapping.yaml中没有涉及的按照内置的api映射进行匹配。
|
|
123
|
-
|
|
124
|
-
此外,也可以通过data_mapping.yaml文件实现具体参数的匹配,例:
|
|
125
|
-
```shell
|
|
126
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -dm data_mapping.yaml
|
|
127
|
-
```
|
|
128
|
-
data_mapping.yaml的写法请参见[自定义映射文件(data_mapping)](#45-自定义映射文件data_mapping)。
|
|
129
|
-
|
|
130
|
-
5. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
131
|
-
|
|
132
|
-
### 2.6 跨框架的cell模块比对
|
|
133
|
-
|
|
134
|
-
1. 配置[config.json](../config.json)文件level配置为L0、task配置为tensor或statistics并指定需要dump的cell模块名。
|
|
135
|
-
|
|
136
|
-
2. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》和《[PyTorch 场景的精度数据采集](./05.data_dump_PyTorch.md)》完成不同环境下cell模块精度数据的采集,得到两个框架的cell模块dump数据。
|
|
137
|
-
|
|
138
|
-
3. 创建比对文件,文件内容及示例请参见[比对文件](#41-比对文件)。
|
|
139
|
-
|
|
140
|
-
4. 执行如下示例命令进行比对:
|
|
141
|
-
|
|
142
|
-
```shell
|
|
143
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -cm
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
或
|
|
147
|
-
|
|
148
|
-
```shell
|
|
149
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -cm cell_mapping.yaml
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
cell_mapping.yaml文件配置请参见[自定义映射文件(cell_mapping)](#44-自定义映射文件cell_mapping)。
|
|
153
|
-
不传入cell_mapping.yaml的情况下仅将Cell改成Module后进行匹配;传入cell_mapping.yaml的情况下将按照cell_mapping.yaml的内容进行匹配。
|
|
154
|
-
|
|
155
|
-
此外,也可以通过data_mapping.yaml文件实现具体参数的匹配,例:
|
|
156
|
-
```shell
|
|
157
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -dm data_mapping.yaml
|
|
158
|
-
```
|
|
159
|
-
data_mapping.yaml的写法请参见[自定义映射文件(data_mapping)](#45-自定义映射文件data_mapping)。
|
|
160
|
-
|
|
161
|
-
5. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
162
|
-
|
|
163
|
-
### 2.7 跨框架的Layer层比对
|
|
164
|
-
|
|
165
|
-
layer_mapping可以从Layer层识别整网的API和Cell,简化配置。
|
|
166
|
-
|
|
167
|
-
1. 配置[config.json](../config.json)文件level配置为L0或mix、task配置为tensor或statistics并指定需要dump的API或模块名。
|
|
168
|
-
|
|
169
|
-
2. 参见《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》和《[PyTorch 场景的精度数据采集](./05.data_dump_PyTorch.md)》完成不同环境下API或模块精度数据的采集,得到两个框架的API或模块dump数据。
|
|
170
|
-
|
|
171
|
-
3. 创建比对文件,文件内容及示例请参见[比对文件](#41-比对文件)。
|
|
172
|
-
|
|
173
|
-
4. 执行如下示例命令进行比对:
|
|
174
|
-
|
|
175
|
-
```shell
|
|
176
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -lm layer_mapping.yaml
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
layer_mapping.yaml文件配置请参见[自定义映射文件(layer_mapping)](#46-自定义映射文件layer_mapping)。
|
|
180
|
-
|
|
181
|
-
此外,也可以通过data_mapping.yaml文件实现具体参数的匹配,例:
|
|
182
|
-
```shell
|
|
183
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output -s -dm data_mapping.yaml
|
|
184
|
-
```
|
|
185
|
-
data_mapping.yaml的写法请参见[自定义映射文件(data_mapping)](#45-自定义映射文件data_mapping)。
|
|
186
|
-
|
|
187
|
-
5. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
188
|
-
|
|
189
|
-
### 2.8 单点数据比对
|
|
190
|
-
1. 参见 [单点保存工具](./28.debugger_save_instruction.md)章节完成 CPU 或 GPU 与 NPU 的单点数据采集。
|
|
191
|
-
|
|
192
|
-
2. 创建比对文件,文件内容及示例请参见[比对文件(单点数据)](#47-比对文件单点数据)。
|
|
193
|
-
|
|
194
|
-
3. 执行如下示例命令进行比对:
|
|
195
|
-
|
|
196
|
-
```shell
|
|
197
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
4. Pytorch & MindSpore 动态图场景查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
201
|
-
MindSpore静态图场景比对结果:
|
|
202
|
-
- `result.csv` 文件列出了所有执行精度比对的 单点保存数据 详细信息和比对结果,示例如下:
|
|
203
|
-
|
|
204
|
-

|
|
205
|
-
具体字段含义同PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
206
|
-
|
|
207
|
-
### 2.9 动静态图场景L0混合dump数据比对
|
|
208
|
-
|
|
209
|
-
1. 参见 [msprobe工具MindSpore场景精度数据采集指南](./06.data_dump_MindSpore.md),执行dump操作。<br>动态图场景下使用 `mindspore.jit` 装饰特定 Cell 或 function 时,被装饰的部分会被编译成静态图执行。采集的数据文件目录结构示例如下:
|
|
210
|
-
```lua
|
|
211
|
-
├── graph
|
|
212
|
-
│ ├── step0
|
|
213
|
-
│ | ├── rank
|
|
214
|
-
│ | │ ├── dump_tensor_data
|
|
215
|
-
| | | | ├── Cell.wrap_net.net.Net.forward.0.input.0.npy
|
|
216
|
-
| | | | ├── Cell.wrap_net.net.Net.forward.0.output.0.npy
|
|
217
|
-
| | | | ...
|
|
218
|
-
│ | | ├── dump.json
|
|
219
|
-
│ | | ├── stack.json
|
|
220
|
-
│ | | └── construct.json
|
|
221
|
-
│ ├── ...
|
|
222
|
-
├── pynative
|
|
223
|
-
│ ├── step0
|
|
224
|
-
│ | ├── rank
|
|
225
|
-
│ | │ ├── dump_tensor_data
|
|
226
|
-
| | | | ├── Cell.dense1.Dense.forward.0.input.0.npy
|
|
227
|
-
| | | | ├── Cell.dense1.Dense.forward.0.output.0.npy
|
|
228
|
-
| | | | ...
|
|
229
|
-
│ | | ├── dump.json
|
|
230
|
-
│ | | ├── stack.json
|
|
231
|
-
│ | | └── construct.json
|
|
232
|
-
│ ├── ...
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
2. 创建比对文件,文件内容及示例请参见[比对文件(动静态图场景L0混合数据)](#48-比对文件动静态图场景l0混合数据)。
|
|
236
|
-
|
|
237
|
-
3. 执行如下示例命令进行比对:
|
|
238
|
-
|
|
239
|
-
```shell
|
|
240
|
-
msprobe -f mindspore compare -i ./compare.json -o ./output
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
4. 动静态图场景L0混合dump数据比对结果,示例如下:
|
|
244
|
-
```lua
|
|
245
|
-
├── graph
|
|
246
|
-
│ ├── step0
|
|
247
|
-
│ | ├── advisor_rank_20250805043414.txt
|
|
248
|
-
│ | ├── compare_result_rank_20250805043411.xlsx
|
|
249
|
-
├── pynative
|
|
250
|
-
│ ├── step0
|
|
251
|
-
│ | ├── advisor_rank_20250805043416.txt
|
|
252
|
-
│ | ├── compare_result_rank_20250805043414.xlsx
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
output目录下生成两个graph和pynative两个文件夹,每个文件夹下生成对应step的比对结果。
|
|
256
|
-
|
|
257
|
-
5. 查看比对结果,请详见PyTorch目录下的《[PyTorch 场景的精度比对-精度比对结果分析](./10.accuracy_compare_PyTorch.md#3-精度比对结果分析)》章节。
|
|
258
|
-
|
|
259
|
-
### 2.10 首差异算子节点识别
|
|
260
|
-
参见《[PyTorch 场景的精度比对-首差异算子节点识别](./10.accuracy_compare_PyTorch.md#215-首差异算子节点识别场景)》章节。
|
|
261
|
-
|
|
262
|
-
## 3 多卡比对结果提取汇总通信算子数据
|
|
263
|
-
|
|
264
|
-
本功能是将多卡比对场景的比对结果,进行通信算子数据提取和汇总,输出整理好的通信算子多卡比对精度表。
|
|
265
|
-
|
|
266
|
-
**使用场景**
|
|
267
|
-
|
|
268
|
-
已完成精度比对,获得多卡精度比对结果,但是通信算子数据分布在多个结果件中,不利于精度问题的分析。通过此功能,可以汇总多卡通信算子数据,减少问题定位时间。
|
|
269
|
-
|
|
270
|
-
**约束**
|
|
271
|
-
|
|
272
|
-
- 不支持MD5比对结果。
|
|
273
|
-
- 不支持MindSpore静态图比对结果。
|
|
274
|
-
|
|
275
|
-
**命令示例**
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
msprobe -f mindspore merge_result -i ./input_dir -o ./output_dir -config ./config.yaml
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**完整参数说明**
|
|
282
|
-
|
|
283
|
-
| 参数名 | 说明 | 是否必选 |
|
|
284
|
-
|-----------------------|-------------------------------------------------------------------------------------------------------------------| -------- |
|
|
285
|
-
| -f 或 --framework | 指定训练框架。mindspore。 | 是 |
|
|
286
|
-
| -i 或 --input_dir | 多卡比对结果存盘目录,即使用compare比对的结果输出目录,str类型。所有比对结果应全部为真实数据比对结果或统计数据比对结果,否则可能导致汇总数据不完整。 | 是 |
|
|
287
|
-
| -o 或 --output_dir | 数据提取汇总结果存盘目录,str类型。文件名称基于时间戳自动生成,格式为:`multi_ranks_compare_merge_{timestamp}.xlsx`。<br>提示:output目录下与结果件同名文件将被删除覆盖。 | 是 |
|
|
288
|
-
| -config或--config-path | 指定需要汇总数据的API和比对指标的yaml文件路径,str类型。<br>yaml文件详细介绍见下文“**yaml文件说明**”。 | 是 |
|
|
289
|
-
|
|
290
|
-
**yaml文件说明**
|
|
291
|
-
|
|
292
|
-
以config.yaml文件名为例,配置示例如下:
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
api:
|
|
296
|
-
- Distributed.all_reduce
|
|
297
|
-
- Distributed.all_gather_into_tensor
|
|
298
|
-
compare_index:
|
|
299
|
-
- Max diff
|
|
300
|
-
- L2norm diff
|
|
301
|
-
- MeanRelativeErr
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
| 参数名 | 说明 |
|
|
305
|
-
| ------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
306
|
-
| 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。 |
|
|
307
|
-
| 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 |
|
|
308
|
-
|
|
309
|
-
**汇总结果件说明**
|
|
310
|
-
|
|
311
|
-
多卡数据汇总结果如下所示:
|
|
312
|
-
|
|
313
|
-

|
|
314
|
-
|
|
315
|
-
1. NPU Name列表示API或module名称。
|
|
316
|
-
2. rank*列为多卡数据。
|
|
317
|
-
3. 不同比对指标的数据通过不同sheet页呈现。
|
|
318
|
-
4. 如果一个API或module在某张卡上找不到数据,汇总结果中将空白呈现。
|
|
319
|
-
5. 如果比对指标值为N/A,unsupported,Nan,表示无法计算该比对指标值,汇总结果将以”NPU:’NPU max值‘ Bench:’Bench max值‘“呈现。
|
|
320
|
-
6. 针对图示案例,此处NPU:N/A Bench:N/A表示output为None。
|
|
321
|
-
|
|
322
|
-
<br>
|
|
323
|
-
如何基于group信息查看分组数据:
|
|
324
|
-
|
|
325
|
-
以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]的呈现形式。
|
|
326
|
-
|
|
327
|
-
<br>
|
|
328
|
-
常见通信API预期结果:
|
|
329
|
-
|
|
330
|
-
1. Distributed.all_gather:多卡数据汇总,每张卡输入可以不一致,同group内输出一致,输出是张量列表。
|
|
331
|
-
2. Distributed.all_gather_into_tensor:多卡数据汇总,每张卡输入可以不一致,同group内输出一致,输出是张量。
|
|
332
|
-
3. Distributed.all_reduce:多卡数据规约操作,每张卡输入可以不一致,同group内输出一致,为规约结果。
|
|
333
|
-
4. Distributed.reduce_scatter:多卡数据规约操作,每张卡输入可以不一致,输出为group内规约结果的不同部分,输入是张量列表。
|
|
334
|
-
5. Distributed.reduce_scatter_tensor:多卡数据规约操作,每张卡输入可以不一致,输出为group内规约结果的不同部分,输入是张量。
|
|
335
|
-
6. Distributed.broadcast:输入为要广播的数据,输出为广播后的数据。
|
|
336
|
-
7. Distributed.isend:点对点通信,输入为要发送的数据,输出为发送的数据。
|
|
337
|
-
8. Distributed.irecv:点对点通信,输入为原数据,输出为接收的新数据。
|
|
338
|
-
9. Distributed.all_to_all_single:输出数据为所有卡上的数据切分后合并的结果。
|
|
339
|
-
|
|
340
|
-
## 4 附录
|
|
341
|
-
|
|
342
|
-
### 4.1 比对文件
|
|
343
|
-
|
|
344
|
-
以在当前目录创建./compare.json为例,单卡场景示例如下:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
```json
|
|
348
|
-
{
|
|
349
|
-
"npu_path": "./npu_dump/dump.json",
|
|
350
|
-
"bench_path": "./bench_dump/dump.json",
|
|
351
|
-
"stack_path": "./npu_dump/stack.json",
|
|
352
|
-
"is_print_compare_log": true
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
多卡场景示例如下:
|
|
357
|
-
```json
|
|
358
|
-
{
|
|
359
|
-
"npu_path": "./npu_dump/step0", # 需填写到step层级(rank的上一层级)
|
|
360
|
-
"bench_path": "./bench_dump/step0", # 需填写到step层级(rank的上一层级)
|
|
361
|
-
"is_print_compare_log": true
|
|
362
|
-
}
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
**参数说明**
|
|
366
|
-
|
|
367
|
-
| 参数名 | 说明 | 是否必选 |
|
|
368
|
-
| -------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|
|
|
369
|
-
| npu_path | 配置NPU环境下的dump.json文件(单卡场景)或dump目录(多卡场景)。跨框架场景指定为MindSpore的dump.json文件或dump目录。数据类型:str。 | 是 |
|
|
370
|
-
| bench_path | 配置CPU、GPU或NPU环境下的dump.json文件(单卡场景)或dump目录(多卡场景)。跨框架场景指定为PyTorch的dump.json文件或dump目录。数据类型:str。 | 是 |
|
|
371
|
-
| stack_path | 配置NPU dump目录下的stack.json文件。数据类型:str。如果没有配置stack_path,命令行-s参数不生效,程序自动识别是否存在stack.json文件,如存在,则比对结果中呈现NPU_Stack_Info,如不存在,则不呈现。如果配置了stack_path,比对结果中是否呈现NPU_Stack_Info则通过命令行参数-s来控制。 | 否 |
|
|
372
|
-
| is_print_compare_log | 配置是否开启单个算子的日志打屏。可取值true或false,默认为true。关闭后则只输出常规日志。数据类型:bool。 | 否 |
|
|
373
|
-
|
|
374
|
-
### 4.2 比对文件(kernel)
|
|
375
|
-
|
|
376
|
-
仅[不同版本下的全量kernel比对](#23-不同版本下的全量kernel比对)场景支持。
|
|
377
|
-
|
|
378
|
-
以在当前目录创建./compare.json为例,示例如下:
|
|
379
|
-
|
|
380
|
-
- 单卡场景:
|
|
381
|
-
|
|
382
|
-
```json
|
|
383
|
-
{
|
|
384
|
-
"npu_path": "./npu_dump",
|
|
385
|
-
"bench_path": "./bench_dump",
|
|
386
|
-
"rank_id": [1],
|
|
387
|
-
"step_id": []
|
|
388
|
-
}
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
- 多卡场景:
|
|
392
|
-
|
|
393
|
-
```json
|
|
394
|
-
{
|
|
395
|
-
"npu_path": "./npu_dump",
|
|
396
|
-
"bench_path": "./bench_dump",
|
|
397
|
-
"rank_id": [],
|
|
398
|
-
"step_id": []
|
|
399
|
-
}
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
**参数说明**
|
|
404
|
-
|
|
405
|
-
| 参数名 | 说明 | 是否必选 |
|
|
406
|
-
| ---------- | ------------------------------------------------------------ | -------- |
|
|
407
|
-
| npu_path | 配置NPU环境下的真实数据目录。数据类型:str。 | 是 |
|
|
408
|
-
| bench_path | 配置NPU环境下的真实数据目录。数据类型:str。 | 是 |
|
|
409
|
-
| rank_id | 配置比对的Rank ID。npu_path和bench_path目录下的dump文件需要存在对应Rank的数据。默认为空,表示比对所有Rank。可配置一个或多个Rank,多个Rank ID用逗号隔开,例如:"rank_id": [1,2,3]。数据类型:list[int]。 | 否 |
|
|
410
|
-
| step_id | 配置比对的Step ID。npu_path和bench_path目录下的dump文件需要存在对应Step的数据。默认为空,表示比对所有Step。可配置一个或多个Step,多个Step ID用逗号隔开,例如:"step_id": [1,2,3]。数据类型:list[int]。 | 否 |
|
|
411
|
-
|
|
412
|
-
### 4.3 自定义映射文件(api_mapping)
|
|
413
|
-
|
|
414
|
-
文件名格式:\*.yaml,*为文件名,可自定义。
|
|
415
|
-
|
|
416
|
-
文件内容格式:
|
|
417
|
-
|
|
418
|
-
```yaml
|
|
419
|
-
ms_api: {ms_api_name}
|
|
420
|
-
pt_api: {pt_api_name}
|
|
421
|
-
ms_args:
|
|
422
|
-
- {index1}
|
|
423
|
-
- {index2}
|
|
424
|
-
...
|
|
425
|
-
- {indexN}
|
|
426
|
-
pt_args:
|
|
427
|
-
- {index1}
|
|
428
|
-
- {index2}
|
|
429
|
-
...
|
|
430
|
-
- {indexN}
|
|
431
|
-
ms_outputs:
|
|
432
|
-
- {index1}
|
|
433
|
-
- {index2}
|
|
434
|
-
...
|
|
435
|
-
- {indexN}
|
|
436
|
-
pt_outputs:
|
|
437
|
-
- {index1}
|
|
438
|
-
- {index2}
|
|
439
|
-
...
|
|
440
|
-
- {indexN}
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
- ms_api/pt_api:分别为MindSpore和PyTorch框架的API名称,配置格式为{api_type}.{api_name}。API名称请分别从《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》和《[PyTorch 场景的精度数据采集](./05.data_dump_PyTorch.md)》中的dump.json文件获取。
|
|
444
|
-
- ms_args/pt_args:分别为ms_api/pt_api对应的MindSpore和PyTorch框架API的入参的序号。
|
|
445
|
-
- ms_outputs/pt_outputs:分别为ms_api/pt_api对应的MindSpore和PyTorch框架API的输出的序号。
|
|
446
|
-
|
|
447
|
-
**说明**:
|
|
448
|
-
|
|
449
|
-
- MindSpore和PyTorch框架的API映射关系可以从《[PyTorch与MindSpore API映射表](https://www.mindspore.cn/docs/zh-CN/r2.3.0rc2/note/api_mapping/pytorch_api_mapping.html)》获取,其中PyTorch与MindSpore API名称前缀的映射关系如下:
|
|
450
|
-
|
|
451
|
-
| PyTorch | PyTorch在dump文件中的名称 | MindSpore | MindSpore在dump文件中的名称 |
|
|
452
|
-
| ------------------- | ------------------------- | ---------------- | --------------------------- |
|
|
453
|
-
| torch.nn.functional | Functional | mindspore.ops | Functional |
|
|
454
|
-
| torch.Tensor | Tensor | mindspore.Tensor | Tensor |
|
|
455
|
-
| torch | Torch | mindspore.ops | Functional |
|
|
456
|
-
|
|
457
|
-
实际配置自定义映射文件(API)时需要使用dump文件中的名称。
|
|
458
|
-
|
|
459
|
-
- 自定义映射文件(API)需要满足ms_args/pt_args列表中的元素个数一致,ms_outputs/pt_outputs相同。
|
|
460
|
-
|
|
461
|
-
- 须确保列表自定义映射文件(API)配置元素的合法性,比如ms_args/pt_args的API用到的参数只有3个参数,那么用户实际指定的参数序号只能包含0、1、2;另外参数序号列表中的值不能重复。
|
|
462
|
-
|
|
463
|
-
文件内容示例:
|
|
464
|
-
|
|
465
|
-
```yaml
|
|
466
|
-
ms_api: Functional.abs
|
|
467
|
-
pt_api: Torch.abs
|
|
468
|
-
ms_args:
|
|
469
|
-
- 0
|
|
470
|
-
- 1
|
|
471
|
-
pt_args:
|
|
472
|
-
- 0
|
|
473
|
-
- 1
|
|
474
|
-
ms_outputs:
|
|
475
|
-
- 0
|
|
476
|
-
- 1
|
|
477
|
-
pt_outputs:
|
|
478
|
-
- 0
|
|
479
|
-
- 1
|
|
480
|
-
# ms_args/pt_args和ms_outputs/pt_outputs参数的配置需要根据ms_api/pt_api的API入参和输出的顺序,例如Functional.abs API的入参为(a b c),那对应的ms_args为0 1 2,可根据实际需要选择,而Torch.abs的入参如果是(a b c),那么ms_args和pt_args配置一致即可,但如果Torch.abs的入参如果是(a c)或其他与Functional.abs不完全映射的值,那么ms_args和pt_args配置的序号需要与入参对应,Torch.abs(a c)的序号为0 1,Functional.abs(a b c)为0 1 2,只有a和c参数可以映射,那么ms_args配置为0 2,pt_args配置为0 1。ms_outputs/pt_outputs同理。
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
### 4.4 自定义映射文件(cell_mapping)
|
|
484
|
-
|
|
485
|
-
文件名格式:\*.yaml,*为文件名,可自定义。
|
|
486
|
-
|
|
487
|
-
文件内容格式:
|
|
488
|
-
|
|
489
|
-
```yaml
|
|
490
|
-
{cell_name}.{class_name}: {module_name}.{class_name}
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
文件内容示例:
|
|
494
|
-
|
|
495
|
-
```yaml
|
|
496
|
-
fc2.Dense: fc2.Linear
|
|
497
|
-
conv1.Conv2d: conv3.Conv2d
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
冒号左侧为MindSpore框架cell模块的{cell_name}.{class_name},冒号右侧为PyTorch框架module模块的{module_name}.{class_name}。
|
|
501
|
-
|
|
502
|
-
```yaml
|
|
503
|
-
{cell_name}.{class_name}从dump cell模块级.npy文件名获取,命名格式为:
|
|
504
|
-
{Cell}.{cell_name}.{class_name}.{forward/backward}.{index}.{input/output}.{参数序号/参数名}
|
|
505
|
-
或
|
|
506
|
-
{Cell}.{cell_name}.{class_name}.parameters_grad.{parameter_name}
|
|
507
|
-
|
|
508
|
-
{module_name}.{class_name}从dump module模块级.npy文件名获取,命名格式为:
|
|
509
|
-
{Module}.{module_name}.{class_name}.{forward/backward}.{index}.{input/output}.{参数序号/参数名}
|
|
510
|
-
或
|
|
511
|
-
{Module}.{module_name}.{class_name}.parameters_grad.{parameter_name}
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### 4.5 自定义映射文件(data_mapping)
|
|
515
|
-
|
|
516
|
-
文件名格式:\*.yaml,*为文件名,可自定义。
|
|
517
|
-
|
|
518
|
-
文件内容格式:
|
|
519
|
-
|
|
520
|
-
```yaml
|
|
521
|
-
# API
|
|
522
|
-
{api_type}.{api_name}.{API调用次数}.{forward/backward}.{input/output}.{参数序号/参数名}: {api_type}.{api_name}.{API调用次数}.{forward/backward}.{input/output}.{参数序号/参数名}
|
|
523
|
-
# 模块
|
|
524
|
-
{Cell}.{cell_name}.{class_name}.{forward/backward}.{index}.{input/output}.{参数序号/参数名}: {Module}.{module_name}.{class_name}.{forward/backward}.{index}.{input/output}.{参数序号/参数名}
|
|
525
|
-
或
|
|
526
|
-
{Cell}.{cell_name}.{class_name}.parameters_grad.{parameter_name}: {Module}.{module_name}.{class_name}.parameters_grad.{parameter_name}
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
冒号左侧为MindSpore框架API的名称和Cell模块的名称,冒号右侧为PyTorch框架API的名称和module模块名称。
|
|
530
|
-
|
|
531
|
-
API和模块名称请分别从《[MindSpore 场景的精度数据采集](./06.data_dump_MindSpore.md)》和《[PyTorch 场景的精度数据采集](./05.data_dump_PyTorch.md)》中的dump.json文件获取。
|
|
532
|
-
|
|
533
|
-
文件内容示例:
|
|
534
|
-
|
|
535
|
-
```yaml
|
|
536
|
-
# API
|
|
537
|
-
Functional.flash_attention_score.4.forward.input.0: NPU.npu_fusion_attention.4.forward.input.0
|
|
538
|
-
# 模块
|
|
539
|
-
Cell.relu.ReLU.forward.0.input.0: Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.forward.0.input.0
|
|
540
|
-
或
|
|
541
|
-
Cell.relu.ReLU.parameters_grad.weight: Module.module.language_model.embedding.word_embedding.VocabParallelEmbedding.parameters_grad.weight
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
当dump.json文件中存在“data_name”字段时,API和模块名称为data_name字段去掉文件后缀,如下图红框处所示:
|
|
545
|
-
|
|
546
|
-
- MindSpore dump
|
|
547
|
-
|
|
548
|
-

|
|
549
|
-
|
|
550
|
-
- PyTorch dump
|
|
551
|
-
|
|
552
|
-

|
|
553
|
-
|
|
554
|
-
当dump.json文件中不存在“data_name”字段时,名称的拼写规则如下:
|
|
555
|
-
|
|
556
|
-
input_args、input_kwargs和output使用统一的命名规则,当值是list类型时,名称后面添加'.{index}',当值类型是dict类型时,名称后面加'.{key}',当值类型是具体Tensor或null或空list/dict时,命名结束。
|
|
557
|
-
|
|
558
|
-
以下面cell的dump文件为例:
|
|
559
|
-
```yaml
|
|
560
|
-
"Cell.network.module.NetworkWithLoss.forward.0": {
|
|
561
|
-
"input_args": [
|
|
562
|
-
{
|
|
563
|
-
"type": "mindspore.Tensor",
|
|
564
|
-
"dtype": "Float32",
|
|
565
|
-
"shape": [
|
|
566
|
-
24,
|
|
567
|
-
16,
|
|
568
|
-
1,
|
|
569
|
-
60,
|
|
570
|
-
34
|
|
571
|
-
],
|
|
572
|
-
"Max": 3.591925621032715,
|
|
573
|
-
"Min": -3.6856653690338135,
|
|
574
|
-
"Mean": -0.017044123262166977,
|
|
575
|
-
"Norm": 940.671630859375,
|
|
576
|
-
"md5": "00d69ba8"
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
"y": {
|
|
580
|
-
"type": "mindspore.Tensor",
|
|
581
|
-
"dtype": "Float32",
|
|
582
|
-
"shape": [
|
|
583
|
-
24,
|
|
584
|
-
1,
|
|
585
|
-
100,
|
|
586
|
-
4096
|
|
587
|
-
],
|
|
588
|
-
"Max": 2.433350086212158,
|
|
589
|
-
"Min": -4.09375,
|
|
590
|
-
"Mean": -0.00010696164099499583,
|
|
591
|
-
"Norm": 170.3390655517578,
|
|
592
|
-
"md5": "a72e1fa4"
|
|
593
|
-
},
|
|
594
|
-
"y_mask": {
|
|
595
|
-
"type": "mindspore.Tensor",
|
|
596
|
-
"dtype": "Float32",
|
|
597
|
-
"shape": [
|
|
598
|
-
24,
|
|
599
|
-
100
|
|
600
|
-
],
|
|
601
|
-
"Max": 1.0,
|
|
602
|
-
"Min": 0.0,
|
|
603
|
-
"Mean": 0.22999998927116394,
|
|
604
|
-
"Norm": 23.494680404663086,
|
|
605
|
-
"md5": "bbcbd5ab"
|
|
606
|
-
},
|
|
607
|
-
"x_mask": {
|
|
608
|
-
"type": "mindspore.Tensor",
|
|
609
|
-
"dtype": "Float32",
|
|
610
|
-
"shape": [
|
|
611
|
-
24,
|
|
612
|
-
510
|
|
613
|
-
],
|
|
614
|
-
"Max": 1.0,
|
|
615
|
-
"Min": 1.0,
|
|
616
|
-
"Mean": 1.0,
|
|
617
|
-
"Norm": 110.63453674316406,
|
|
618
|
-
"md5": "766d1028"
|
|
619
|
-
},
|
|
620
|
-
"loss_mask": {
|
|
621
|
-
"type": "mindspore.Tensor",
|
|
622
|
-
"dtype": "Float32",
|
|
623
|
-
"shape": [
|
|
624
|
-
24,
|
|
625
|
-
1,
|
|
626
|
-
60,
|
|
627
|
-
34
|
|
628
|
-
],
|
|
629
|
-
"Max": 1.0,
|
|
630
|
-
"Min": 1.0,
|
|
631
|
-
"Mean": 1.0,
|
|
632
|
-
"Norm": 221.26907348632812,
|
|
633
|
-
"md5": "0cb690ce"
|
|
634
|
-
},
|
|
635
|
-
"data_info": {
|
|
636
|
-
"img_hw": null
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
],
|
|
640
|
-
"input_kwargs": {},
|
|
641
|
-
"output": [
|
|
642
|
-
{
|
|
643
|
-
"type": "mindspore.Tensor",
|
|
644
|
-
"dtype": "Float32",
|
|
645
|
-
"shape": [],
|
|
646
|
-
"Max": 0.3672327995300293,
|
|
647
|
-
"Min": 0.3672327995300293,
|
|
648
|
-
"Mean": 0.3672327995300293,
|
|
649
|
-
"Norm": 0.3672327995300293,
|
|
650
|
-
"md5": "28f8f74f"
|
|
651
|
-
}
|
|
652
|
-
]
|
|
653
|
-
}
|
|
654
|
-
```
|
|
655
|
-
,
|
|
656
|
-
初始名称为`Cell.network.module.NetworkWithLoss.forward.0`,`input_args`是`list`,长度为2,按照顺序命名为
|
|
657
|
-
```
|
|
658
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.0
|
|
659
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1
|
|
660
|
-
```
|
|
661
|
-
第0项后面直接是`Tensor`,命名结束
|
|
662
|
-
第1项后面是`dict`,key包括`y`、`y_mask`、`x_mask`和`data_info`,命名为
|
|
663
|
-
```
|
|
664
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.y
|
|
665
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.y_mask
|
|
666
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.x_mask
|
|
667
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.data_info
|
|
668
|
-
```
|
|
669
|
-
`y`后面是`Tensor`,命名结束;`y_mask`后面是`Tensor`,命名结束;`x_mask`后面是`Tensor`,命名结束;`data_info`后面是`dict`,key是`img_hw`,命名为
|
|
670
|
-
```
|
|
671
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.data_info.img_hw
|
|
672
|
-
```
|
|
673
|
-
`img_hw`后面是`null`,命名结束。
|
|
674
|
-
|
|
675
|
-
`input_kwargs`是`dict`,长度为0,命名结束。
|
|
676
|
-
`output`是`list`,长度为1,按照顺序命名为
|
|
677
|
-
```
|
|
678
|
-
Cell.network.module.NetworkWithLoss.forward.0.output.0
|
|
679
|
-
```
|
|
680
|
-
第0项后面是`Tensor`,命名结束。
|
|
681
|
-
|
|
682
|
-
综上,生成的op_name为:
|
|
683
|
-
```
|
|
684
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.0
|
|
685
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.y
|
|
686
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.y_mask
|
|
687
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.x_mask
|
|
688
|
-
Cell.network.module.NetworkWithLoss.forward.0.input.1.data_info.img_hw
|
|
689
|
-
Cell.network.module.NetworkWithLoss.forward.0.output.0
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
### 4.6 自定义映射文件(Layer_mapping)
|
|
693
|
-
|
|
694
|
-
文件名格式:\*.yaml,*为文件名,可自定义。
|
|
695
|
-
|
|
696
|
-
文件内容示例:
|
|
697
|
-
|
|
698
|
-
```yaml
|
|
699
|
-
ParallelAttention: # Layer层名称
|
|
700
|
-
qkv_proj: query_key_value # 冒号左侧为MindSpore框架模型代码中嵌套的Layer层名称,冒号右侧为PyTorch框架模型代码中嵌套的Layer层名称
|
|
701
|
-
out_proj: dense
|
|
702
|
-
|
|
703
|
-
ParallelTransformerLayer:
|
|
704
|
-
attention: self_attention
|
|
705
|
-
|
|
706
|
-
Embedding:
|
|
707
|
-
dropout: embedding_dropout
|
|
708
|
-
|
|
709
|
-
ParallelMLP:
|
|
710
|
-
mapping: dense_h_to_4h
|
|
711
|
-
projection: dense_4h_to_h
|
|
712
|
-
|
|
713
|
-
PipelineCell:
|
|
714
|
-
model: module
|
|
715
|
-
|
|
716
|
-
Cell:
|
|
717
|
-
network_with_loss: module
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
Layer层名称需要从模型代码中获取。
|
|
721
|
-
|
|
722
|
-
yaml文件中只需配置MindSpore与PyTorch模型代码中功能一致但名称不同的Layer层,名称相同的Layer层会被自动识别并映射。
|
|
723
|
-
|
|
724
|
-
模型代码示例:
|
|
725
|
-
|
|
726
|
-

|
|
727
|
-
|
|
728
|
-
### 4.7 比对文件(单点数据)
|
|
729
|
-
|
|
730
|
-
MindSpore动态图单卡场景示例如下:
|
|
731
|
-
```json
|
|
732
|
-
{
|
|
733
|
-
"npu_path": "./npu_dump/debug.json",
|
|
734
|
-
"bench_path": "./bench_dump/debug.json"
|
|
735
|
-
}
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
MindSpore动态图多卡场景(step0目录下包含debug.json文件)示例如下:
|
|
739
|
-
```json
|
|
740
|
-
{
|
|
741
|
-
"npu_path": "./npu_dump/step0",
|
|
742
|
-
"bench_path": "./bench_dump/step0"
|
|
743
|
-
}
|
|
744
|
-
```
|
|
745
|
-
|
|
746
|
-
MindSpore静态图场景(不区分单/多卡)示例如下:
|
|
747
|
-
```json
|
|
748
|
-
{
|
|
749
|
-
"npu_path": "./npu_dump/",
|
|
750
|
-
"bench_path": "./bench_dump/",
|
|
751
|
-
"map_dict": {"input": "x"},
|
|
752
|
-
"common": true
|
|
753
|
-
}
|
|
754
|
-
```
|
|
755
|
-
- `npu_path`表示NPU dump文件目录,可指定到./npu_dump/ 或者./npu_dump/step0 或者./npu_dump/step0/rank0 保证对应即可,比对结果保持相同目录结构。
|
|
756
|
-
- `bench_path`表示bench dump文件目录,指定同上。
|
|
757
|
-
- `common`表示开启MindSpore静态图单点保存比对,默认关闭。
|
|
758
|
-
- `map_dict`可用于当单点保存比对的`npy`文件名称不完全对应时,通过手动指定保证比对正确执行,比对指定名称对应,如{"input": "x"},则`input_float32_1.npy`会对应`x_float32_1.npy`。
|
|
759
|
-
|
|
760
|
-
### 4.8 比对文件(动静态图场景L0混合数据)
|
|
761
|
-
```json
|
|
762
|
-
{
|
|
763
|
-
"npu_path": "./npu_dump",
|
|
764
|
-
"bench_path": "./bench_dump",
|
|
765
|
-
"is_print_compare_log": true
|
|
766
|
-
}
|
|
767
|
-
```
|
|
768
|
-
- npu_path表示NPU dump文件目录,上面示例中的 ./npu_dump/ 是npu侧动静态图dump后graph和pynative目录的父目录。
|
|
769
|
-
- bench_path表示Bench dump文件目录,上面示例中的 ./bench_dump/ 是bench侧动静态图dump后graph和pynative目录的父目录。
|