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
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# This file is part of the MindStudio project.
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co.,Ltd.
|
|
4
|
+
#
|
|
5
|
+
# MindStudio is licensed under Mulan PSL v2.
|
|
6
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
7
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
8
|
+
#
|
|
9
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
10
|
+
#
|
|
11
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
12
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
13
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
14
|
+
# See the Mulan PSL v2 for more details.
|
|
15
|
+
# -------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import time
|
|
19
|
+
import json
|
|
20
|
+
from tensorboard.util import tb_logging
|
|
21
|
+
|
|
22
|
+
from .graph_service_base import GraphServiceStrategy
|
|
23
|
+
from ..repositories.graph_repo_vis import GraphRepoVis
|
|
24
|
+
from ..utils.global_state import GraphState
|
|
25
|
+
from ..utils.graph_utils import GraphUtils
|
|
26
|
+
from ..model.layout_hierarchy_model import LayoutHierarchyModel
|
|
27
|
+
from ..model.match_nodes_model import MatchNodesController
|
|
28
|
+
from ..utils.constant import NPU_PREFIX, BENCH_PREFIX, NPU, BENCH, SINGLE, UN_MATCHED_VALUE
|
|
29
|
+
from ..utils.constant import MAX_RELATIVE_ERR, MIN_RELATIVE_ERR, MEAN_RELATIVE_ERR, NORM_RELATIVE_ERR
|
|
30
|
+
|
|
31
|
+
logger = tb_logging.get_logger()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class JsonGraphService(GraphServiceStrategy):
|
|
35
|
+
|
|
36
|
+
def __init__(self, run_path, tag):
|
|
37
|
+
super().__init__(run_path, tag)
|
|
38
|
+
self.repo = None
|
|
39
|
+
|
|
40
|
+
def load_graph_data(self):
|
|
41
|
+
runs = GraphState.get_global_value('runs')
|
|
42
|
+
run_path = runs.get(self.run)
|
|
43
|
+
buffer = ""
|
|
44
|
+
read_bytes = 0
|
|
45
|
+
chunk_size = 1024 * 1024 * 60 # 缓冲区
|
|
46
|
+
json_data = None # 最终存储的变量
|
|
47
|
+
_, error = GraphUtils.safe_load_data(run_path, f"{self.tag}.vis", True)
|
|
48
|
+
if error:
|
|
49
|
+
return {'success': False, 'error': GraphUtils.t('loadErrorBySecurityIssue')}
|
|
50
|
+
file_path = os.path.join(run_path, f"{self.tag}.vis")
|
|
51
|
+
file_path = os.path.normpath(file_path) # 标准化路径
|
|
52
|
+
file_size = os.path.getsize(file_path)
|
|
53
|
+
if file_size == 0:
|
|
54
|
+
return {'success': False, 'error': '文件为空'}
|
|
55
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
56
|
+
while True:
|
|
57
|
+
chunk = f.read(chunk_size)
|
|
58
|
+
if not chunk:
|
|
59
|
+
break
|
|
60
|
+
read_bytes += len(chunk)
|
|
61
|
+
buffer += chunk
|
|
62
|
+
current_progress = min(95, int((read_bytes / file_size) * 100))
|
|
63
|
+
reading_info = {
|
|
64
|
+
'progress': current_progress,
|
|
65
|
+
'status': 'reading',
|
|
66
|
+
'size': file_size,
|
|
67
|
+
'read': read_bytes
|
|
68
|
+
}
|
|
69
|
+
yield f"data: {json.dumps(reading_info)}\n\n"
|
|
70
|
+
time.sleep(0.01) # 避免发送过快
|
|
71
|
+
|
|
72
|
+
if json_data is None and buffer: # 最终验证数据
|
|
73
|
+
try:
|
|
74
|
+
yield f"data: {json.dumps({'progress': current_progress, 'status': 'loading'})}\n\n"
|
|
75
|
+
json_data = GraphUtils.safe_json_loads(buffer)
|
|
76
|
+
yield f"data: {json.dumps({'progress': 99, 'status': 'loading'})}\n\n"
|
|
77
|
+
except json.JSONDecodeError as e:
|
|
78
|
+
err_str = json.dumps({'progress': current_progress, 'error': GraphUtils.t('parseJsonFailed')})
|
|
79
|
+
yield f"data: {err_str}\n\n"
|
|
80
|
+
|
|
81
|
+
if json_data is not None: # 验证存储
|
|
82
|
+
GraphState.set_global_value('current_file_data', json_data)
|
|
83
|
+
GraphState.set_global_value('current_tag', self.tag)
|
|
84
|
+
GraphState.set_global_value('current_run', run_path)
|
|
85
|
+
# 初始化GraphJson
|
|
86
|
+
self.repo = GraphRepoVis(json_data)
|
|
87
|
+
yield f"data: {json.dumps({'done': True, 'progress': 100, 'status': 'loading'})}\n\n"
|
|
88
|
+
else:
|
|
89
|
+
yield f"data: {json.dumps({'progress': current_progress, 'error': GraphUtils.t('parseJsonFailed')})}\n\n"
|
|
90
|
+
|
|
91
|
+
def load_graph_config_info(self):
|
|
92
|
+
run_name = self.run
|
|
93
|
+
tag = self.tag
|
|
94
|
+
graph_data, error_message = GraphUtils.get_graph_data({'run': run_name, 'tag': tag})
|
|
95
|
+
if error_message or not graph_data:
|
|
96
|
+
return {'success': False, 'error': str(error_message)}
|
|
97
|
+
config = {}
|
|
98
|
+
try:
|
|
99
|
+
# 读取全局信息,tag层面
|
|
100
|
+
if graph_data.get('MicroSteps', {}):
|
|
101
|
+
config['microSteps'] = graph_data.get('MicroSteps')
|
|
102
|
+
if graph_data.get('ToolTip', {}):
|
|
103
|
+
config['tooltips'] = graph_data.get('ToolTip')
|
|
104
|
+
config['overflowCheck'] = bool(graph_data.get('OverflowCheck')) if 'OverflowCheck' in graph_data else True
|
|
105
|
+
config['isSingleGraph'] = False if graph_data.get(NPU) else True
|
|
106
|
+
# 读取配置信息,run层面
|
|
107
|
+
config_data = GraphState.get_global_value("config_data", {})
|
|
108
|
+
config_data_run = config_data.get(run_name, {})
|
|
109
|
+
if not config_data_run: # 如果没有run的配置信息,则读取第一个文件中的Colors
|
|
110
|
+
first_run_tags = GraphState.get_global_value("first_run_tags")
|
|
111
|
+
first_tag = first_run_tags.get(run_name)
|
|
112
|
+
if not first_tag:
|
|
113
|
+
return {'success': False, 'error': GraphUtils.t('loadConfigFailed')}
|
|
114
|
+
first_graph_data, error_message = GraphUtils.get_graph_data({'run': run_name, 'tag': first_tag})
|
|
115
|
+
config_data_run['colors'] = first_graph_data.get('Colors')
|
|
116
|
+
config_data[run_name] = config_data_run
|
|
117
|
+
GraphState.set_global_value('config_data', config_data)
|
|
118
|
+
config['colors'] = first_graph_data.get('Colors')
|
|
119
|
+
else:
|
|
120
|
+
config['colors'] = config_data_run.get('colors')
|
|
121
|
+
# 读取目录下配置文件列表
|
|
122
|
+
config_files = GraphUtils.find_config_files(run_name)
|
|
123
|
+
config['matchedConfigFiles'] = config_files or []
|
|
124
|
+
config['task'] = graph_data.get('task')
|
|
125
|
+
GraphState.set_global_value("config_info", config)
|
|
126
|
+
return {'success': True, 'data': config}
|
|
127
|
+
except Exception as e:
|
|
128
|
+
return {'success': False, 'error': GraphUtils.t('loadConfigFailed')}
|
|
129
|
+
|
|
130
|
+
def load_graph_all_node_list(self, meta_data):
|
|
131
|
+
micro_step = meta_data.get('microStep')
|
|
132
|
+
graph_data, error_message = GraphUtils.get_graph_data({'run': self.run, 'tag': self.tag})
|
|
133
|
+
if error_message or not graph_data:
|
|
134
|
+
return {'success': False, 'error': str(error_message)}
|
|
135
|
+
result = {}
|
|
136
|
+
try:
|
|
137
|
+
if not graph_data.get(NPU):
|
|
138
|
+
nodes = GraphUtils.split_graph_data_by_microstep(graph_data, micro_step)
|
|
139
|
+
node_name_list = list(nodes.keys())
|
|
140
|
+
result['npuNodeList'] = node_name_list
|
|
141
|
+
return {'success': True, 'data': result}
|
|
142
|
+
|
|
143
|
+
else:
|
|
144
|
+
# 双图
|
|
145
|
+
config_data = GraphState.get_global_value("config_data")
|
|
146
|
+
npu_node = GraphUtils.split_graph_data_by_microstep(graph_data.get(NPU), micro_step)
|
|
147
|
+
bench_node = GraphUtils.split_graph_data_by_microstep(graph_data.get(BENCH), micro_step)
|
|
148
|
+
npu_node_name_list = list(npu_node.keys())
|
|
149
|
+
bench_node_name_list = list(bench_node.keys())
|
|
150
|
+
npu_unmatehed_name_list = [
|
|
151
|
+
key
|
|
152
|
+
for key, value in npu_node.items()
|
|
153
|
+
if not value.get("matched_node_link")
|
|
154
|
+
]
|
|
155
|
+
bench_unmatehed_name_list = [
|
|
156
|
+
key
|
|
157
|
+
for key, value in bench_node.items()
|
|
158
|
+
if not value.get("matched_node_link")
|
|
159
|
+
]
|
|
160
|
+
# 保存未匹配和已匹配的节点到全局变量
|
|
161
|
+
config_data['npuUnMatchNodes'] = npu_unmatehed_name_list
|
|
162
|
+
config_data['benchUnMatchNodes'] = bench_unmatehed_name_list
|
|
163
|
+
config_data['npuMatchNodes'] = graph_data.setdefault('npu_match_nodes', {})
|
|
164
|
+
config_data['benchMatchNodes'] = graph_data.setdefault('bench_match_nodes', {})
|
|
165
|
+
# 返回结果
|
|
166
|
+
result['npuNodeList'] = npu_node_name_list
|
|
167
|
+
result['benchNodeList'] = bench_node_name_list
|
|
168
|
+
result['npuUnMatchNodes'] = npu_unmatehed_name_list
|
|
169
|
+
result['benchUnMatchNodes'] = bench_unmatehed_name_list
|
|
170
|
+
result['npuMatchNodes'] = graph_data.setdefault('npu_match_nodes', {})
|
|
171
|
+
result['benchMatchNodes'] = graph_data.setdefault('bench_match_nodes', {})
|
|
172
|
+
for npu_node_name, npu_node in graph_data.get(NPU, {}).get('node', {}).items():
|
|
173
|
+
if npu_node.get('matched_node_link', None):
|
|
174
|
+
bench_node_name = npu_node.get('matched_node_link', [None])[-1].replace(BENCH_PREFIX, '', 1)
|
|
175
|
+
result['npuMatchNodes'][npu_node_name] = bench_node_name
|
|
176
|
+
result['benchMatchNodes'][bench_node_name] = npu_node_name
|
|
177
|
+
|
|
178
|
+
GraphState.set_global_value('config_data', config_data)
|
|
179
|
+
return {'success': True, 'data': result}
|
|
180
|
+
except Exception as e:
|
|
181
|
+
logger.error('get node list error:' + str(e))
|
|
182
|
+
return {'success': False, 'error': GraphUtils.t('getNodeListFailed')}
|
|
183
|
+
|
|
184
|
+
def change_node_expand_state(self, node_info, meta_data):
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
188
|
+
if error_message:
|
|
189
|
+
return {'success': False, 'error': str(error_message)}
|
|
190
|
+
if self.repo is None:
|
|
191
|
+
return {'success': False, 'error': GraphUtils.t('initGraphJsonFailed')}
|
|
192
|
+
graph_type = node_info.get('nodeType')
|
|
193
|
+
node_name = node_info.get('nodeName')
|
|
194
|
+
micro_step = meta_data.get('microStep')
|
|
195
|
+
# 单图
|
|
196
|
+
if not graph_data.get(NPU):
|
|
197
|
+
hierarchy = LayoutHierarchyModel.change_expand_state(node_name, SINGLE, self.repo, micro_step, {})
|
|
198
|
+
# NPU
|
|
199
|
+
elif graph_type == NPU:
|
|
200
|
+
hierarchy = LayoutHierarchyModel.change_expand_state(node_name, NPU, self.repo, micro_step, {})
|
|
201
|
+
# 标杆
|
|
202
|
+
elif graph_type == BENCH:
|
|
203
|
+
hierarchy = LayoutHierarchyModel.change_expand_state(node_name, BENCH, self.repo, micro_step, {})
|
|
204
|
+
else:
|
|
205
|
+
return {'success': True, 'data': {}}
|
|
206
|
+
return {'success': True, 'data': hierarchy}
|
|
207
|
+
except Exception as e:
|
|
208
|
+
logger.error('node expand or collapse error:' + str(e))
|
|
209
|
+
node_type_name = ""
|
|
210
|
+
if graph_data.get(NPU):
|
|
211
|
+
node_type_name = GraphUtils.t('debug') if graph_type == NPU else GraphUtils.t('bench')
|
|
212
|
+
return {'success': False, 'error': f"{node_type_name}{GraphUtils.t('expandNodeError')}", 'data': None}
|
|
213
|
+
|
|
214
|
+
def search_node_by_precision(self, meta_data, values):
|
|
215
|
+
# 遍历所有的NPU节点,如果节点的精度值在values中,则返回该节点
|
|
216
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
217
|
+
if error_message:
|
|
218
|
+
return {'success': False, 'error': str(error_message)}
|
|
219
|
+
|
|
220
|
+
precision = []
|
|
221
|
+
is_filter_unmatch_nodes = True if UN_MATCHED_VALUE in values else False
|
|
222
|
+
try:
|
|
223
|
+
if is_filter_unmatch_nodes:
|
|
224
|
+
values.remove(UN_MATCHED_VALUE)
|
|
225
|
+
# 单图
|
|
226
|
+
if not graph_data.get(NPU):
|
|
227
|
+
node_list = GraphUtils.split_graph_data_by_microstep(graph_data.get('node', {}),
|
|
228
|
+
meta_data.get("microStep", -1))
|
|
229
|
+
# 多图
|
|
230
|
+
else:
|
|
231
|
+
node_list = GraphUtils.split_graph_data_by_microstep(graph_data.get(NPU),
|
|
232
|
+
meta_data.get("microStep", -1))
|
|
233
|
+
for node_name, node in node_list.items():
|
|
234
|
+
subnodes = node.get("subnodes", None)
|
|
235
|
+
if subnodes != [] and subnodes is not None:
|
|
236
|
+
continue
|
|
237
|
+
matched_node_link = node.get('matched_node_link', None)
|
|
238
|
+
if is_filter_unmatch_nodes and (matched_node_link is None or matched_node_link == []):
|
|
239
|
+
precision.append(node_name)
|
|
240
|
+
if any(low <= node.get('data', {}).get("precision_index", -1) < high for low, high in values):
|
|
241
|
+
precision.append(node_name)
|
|
242
|
+
return {'success': True, 'data': precision}
|
|
243
|
+
except Exception as e:
|
|
244
|
+
logger.error('search precision node failed:' + str(e))
|
|
245
|
+
return {'success': False, 'error': GraphUtils.t('obtainNodesAccuracyFailed')}
|
|
246
|
+
|
|
247
|
+
def search_node_by_overflow(self, meta_data, values):
|
|
248
|
+
# 遍历所有的NPU节点,如果节点的精度值在values中,则返回该节点
|
|
249
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
250
|
+
if error_message:
|
|
251
|
+
return {'success': False, 'error': str(error_message)}
|
|
252
|
+
overflow = []
|
|
253
|
+
try:
|
|
254
|
+
# 单图
|
|
255
|
+
if not graph_data.get(NPU):
|
|
256
|
+
node_list = GraphUtils.split_graph_data_by_microstep(graph_data.get('node', {}),
|
|
257
|
+
meta_data.get("microStep", -1))
|
|
258
|
+
for node_name, node in node_list.items():
|
|
259
|
+
subnodes = node.get("subnodes", None)
|
|
260
|
+
if subnodes != [] and subnodes is not None:
|
|
261
|
+
continue
|
|
262
|
+
if node.get('data', {}).get("overflow_level", -1) in values:
|
|
263
|
+
overflow.append(node_name)
|
|
264
|
+
return {'success': True, 'data': overflow}
|
|
265
|
+
else:
|
|
266
|
+
return {'success': False, 'error': GraphUtils.t('notSupportOverflow')}
|
|
267
|
+
except Exception as e:
|
|
268
|
+
logger.error('search overflow node failed:' + str(e))
|
|
269
|
+
return {'success': False, 'error': GraphUtils.t('obtainNodesOverflowFailed')}
|
|
270
|
+
|
|
271
|
+
def update_precision_error(self, meta_data, filter_value):
|
|
272
|
+
try:
|
|
273
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
274
|
+
if error_message:
|
|
275
|
+
return {'success': False, 'error': str(error_message)}
|
|
276
|
+
npu_node_list = graph_data.get(NPU, {}).get('node', {})
|
|
277
|
+
for _, node_info in npu_node_list.items():
|
|
278
|
+
output_statistical_diff = node_info.get('output_data', None)
|
|
279
|
+
if not node_info.get('matched_node_link') or not output_statistical_diff:
|
|
280
|
+
continue
|
|
281
|
+
max_rel_error = -1
|
|
282
|
+
# 根据filter_value 的选择指标计算新的误差值
|
|
283
|
+
for _, diff_values in output_statistical_diff.items():
|
|
284
|
+
filter_diff_rel = []
|
|
285
|
+
if MAX_RELATIVE_ERR in filter_value:
|
|
286
|
+
filter_diff_rel.append(diff_values.get('MaxRelativeErr'))
|
|
287
|
+
if MIN_RELATIVE_ERR in filter_value:
|
|
288
|
+
filter_diff_rel.append(diff_values.get('MinRelativeErr'))
|
|
289
|
+
if NORM_RELATIVE_ERR in filter_value:
|
|
290
|
+
filter_diff_rel.append(diff_values.get('NormRelativeErr'))
|
|
291
|
+
if MEAN_RELATIVE_ERR in filter_value:
|
|
292
|
+
filter_diff_rel.append(diff_values.get('MeanRelativeErr'))
|
|
293
|
+
# 过滤掉N/A
|
|
294
|
+
filter_diff_rel = [x for x in filter_diff_rel if x and x != 'N/A']
|
|
295
|
+
# 如果output指标中存在 Nan/inf/-inf, 直接标记为最大值
|
|
296
|
+
if "Nan" in filter_diff_rel or "inf" in filter_diff_rel or "-inf" in filter_diff_rel:
|
|
297
|
+
max_rel_error = 1
|
|
298
|
+
break
|
|
299
|
+
filter_diff_rel = [GraphUtils.convert_to_float(x) for x in filter_diff_rel]
|
|
300
|
+
max_rel_error_for_key = max(filter_diff_rel) if filter_diff_rel else 0
|
|
301
|
+
max_rel_error = max(max_rel_error, max_rel_error_for_key)
|
|
302
|
+
if max_rel_error != -1:
|
|
303
|
+
node_info.setdefault('data', {})['precision_index'] = min(max_rel_error, 1)
|
|
304
|
+
return {'success': True, 'data': {}}
|
|
305
|
+
except Exception as e:
|
|
306
|
+
logger.error('update precision error error:' + str(e))
|
|
307
|
+
return {'success': False, 'error': GraphUtils.t('updatePrecisionFailed')}
|
|
308
|
+
|
|
309
|
+
def update_hierarchy_data(self, graph_type):
|
|
310
|
+
if (graph_type == NPU or graph_type == BENCH):
|
|
311
|
+
hierarchy = LayoutHierarchyModel.update_hierarchy_data(graph_type)
|
|
312
|
+
return {'success': True, 'data': hierarchy}
|
|
313
|
+
else:
|
|
314
|
+
return {'success': False, 'error': GraphUtils.t('nodeTypeError')}
|
|
315
|
+
|
|
316
|
+
def get_node_info(self, node_info, meta_data):
|
|
317
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
318
|
+
if error_message:
|
|
319
|
+
return {'success': False, 'error': str(error_message)}
|
|
320
|
+
try:
|
|
321
|
+
graph_type = node_info.get('nodeType')
|
|
322
|
+
node_name = node_info.get('nodeName')
|
|
323
|
+
result = {}
|
|
324
|
+
if not graph_data.get(NPU) or graph_type == SINGLE:
|
|
325
|
+
result['npu'] = graph_data.get('node', {}).get(node_name)
|
|
326
|
+
else:
|
|
327
|
+
matched_node_type = BENCH if graph_type == NPU else NPU
|
|
328
|
+
matched_node_preifx = NPU_PREFIX if matched_node_type == NPU else BENCH_PREFIX
|
|
329
|
+
node = graph_data.get(graph_type, {}).get('node', {}).get(node_name, {})
|
|
330
|
+
matched_node_link = node.get('matched_node_link', []) if isinstance(node.get('matched_node_link', []),
|
|
331
|
+
list) else []
|
|
332
|
+
matched_node_name = matched_node_link[-1].replace(matched_node_preifx, '',
|
|
333
|
+
1) if matched_node_link else None
|
|
334
|
+
matched_node = graph_data.get(matched_node_type, {}).get('node', {}).get(
|
|
335
|
+
matched_node_name) if matched_node_name else None
|
|
336
|
+
result['npu'] = node if graph_type == NPU else matched_node
|
|
337
|
+
result['bench'] = node if graph_type == BENCH else matched_node
|
|
338
|
+
return {'success': True, 'data': result}
|
|
339
|
+
except Exception as e:
|
|
340
|
+
logger.error('get node info error:' + str(e))
|
|
341
|
+
return {'success': False, 'error': GraphUtils.t('getNodeInfoError'), 'data': None}
|
|
342
|
+
|
|
343
|
+
def add_match_nodes(self, npu_node_name, bench_node_name, meta_data, is_match_children):
|
|
344
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
345
|
+
if error_message:
|
|
346
|
+
return {'success': False, 'error': str(error_message)}
|
|
347
|
+
task = graph_data.get('task')
|
|
348
|
+
result = {}
|
|
349
|
+
try:
|
|
350
|
+
# 根据任务类型计算误差
|
|
351
|
+
if task == 'md5' or task == 'summary':
|
|
352
|
+
if is_match_children:
|
|
353
|
+
match_result = MatchNodesController.process_task_add_child_layer(graph_data,
|
|
354
|
+
npu_node_name, bench_node_name, task)
|
|
355
|
+
else:
|
|
356
|
+
match_result = MatchNodesController.process_task_add(graph_data,
|
|
357
|
+
npu_node_name, bench_node_name, task)
|
|
358
|
+
return self._generate_matched_result(match_result)
|
|
359
|
+
else:
|
|
360
|
+
return {'success': False, 'error': GraphUtils.t('taskTypeError')}
|
|
361
|
+
except Exception as e:
|
|
362
|
+
return {'success': False, 'error': GraphUtils.t('operationFailed'), 'data': None}
|
|
363
|
+
|
|
364
|
+
def add_match_nodes_by_config(self, config_file_name, meta_data):
|
|
365
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
366
|
+
if error_message:
|
|
367
|
+
return {'success': False, 'error': GraphUtils.t('readFileFailed')}
|
|
368
|
+
match_node_links, error = GraphUtils.safe_load_data(meta_data.get('run'), config_file_name)
|
|
369
|
+
if error:
|
|
370
|
+
return {'success': False, 'error': GraphUtils.t('loadConfigFileError')}
|
|
371
|
+
if not match_node_links:
|
|
372
|
+
return {'success': False, 'error': GraphUtils.t('matchNodeLinksNullError')}
|
|
373
|
+
task = graph_data.get('task')
|
|
374
|
+
try:
|
|
375
|
+
# 根据任务类型计算误差
|
|
376
|
+
if task == 'md5' or task == 'summary':
|
|
377
|
+
match_result = MatchNodesController.process_task_add_child_layer_by_config(graph_data,
|
|
378
|
+
match_node_links, task)
|
|
379
|
+
result = self._generate_matched_result(match_result)
|
|
380
|
+
if result.get('data'):
|
|
381
|
+
result['data']['matchResult'] = [item.get('success', False) for item in match_result]
|
|
382
|
+
return result
|
|
383
|
+
else:
|
|
384
|
+
return {'success': False, 'error': GraphUtils.t('taskTypeError')}
|
|
385
|
+
except Exception as e:
|
|
386
|
+
logger.error(str(e))
|
|
387
|
+
return {'success': False, 'error': GraphUtils.t('operationFailed'), 'data': None}
|
|
388
|
+
|
|
389
|
+
def delete_match_nodes(self, npu_node_name, bench_node_name, meta_data, is_unmatch_children):
|
|
390
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
391
|
+
if error_message:
|
|
392
|
+
return {'success': False, 'error': str(error_message)}
|
|
393
|
+
task = graph_data.get('task')
|
|
394
|
+
try:
|
|
395
|
+
# 根据任务类型计算误差
|
|
396
|
+
if task == 'md5' or task == 'summary':
|
|
397
|
+
if is_unmatch_children:
|
|
398
|
+
match_result = MatchNodesController.process_task_delete_child_layer(graph_data, npu_node_name,
|
|
399
|
+
bench_node_name, task)
|
|
400
|
+
else:
|
|
401
|
+
match_result = MatchNodesController.process_task_delete(graph_data, npu_node_name,
|
|
402
|
+
bench_node_name, task)
|
|
403
|
+
|
|
404
|
+
return self._generate_matched_result(match_result)
|
|
405
|
+
else:
|
|
406
|
+
return {'success': False, 'error': GraphUtils.t('taskTypeError')}
|
|
407
|
+
except Exception as e:
|
|
408
|
+
return {'success': False, 'error': GraphUtils.t('operationFailed'), 'data': None}
|
|
409
|
+
|
|
410
|
+
def save_data(self, meta_data):
|
|
411
|
+
if not meta_data:
|
|
412
|
+
return {'success': False, 'error': GraphUtils.t('parameterEmpty')}
|
|
413
|
+
graph_data, error_message = GraphUtils.get_graph_data(meta_data)
|
|
414
|
+
if error_message:
|
|
415
|
+
return {'success': False, 'error': str(error_message)}
|
|
416
|
+
|
|
417
|
+
try:
|
|
418
|
+
_, error = GraphUtils.safe_save_data(graph_data, self.run, f"{self.tag}.vis")
|
|
419
|
+
if error:
|
|
420
|
+
return {'success': False, 'error': error}
|
|
421
|
+
except (ValueError, IOError, PermissionError) as e:
|
|
422
|
+
return {'success': False, 'error': GraphUtils.t('saveFileFailed')}
|
|
423
|
+
return {'success': True}
|
|
424
|
+
|
|
425
|
+
def update_colors(self, colors):
|
|
426
|
+
"""Set new colors in jsondata."""
|
|
427
|
+
try:
|
|
428
|
+
config_data = GraphState.get_global_value("config_data", {})
|
|
429
|
+
first_run_tags = GraphState.get_global_value("first_run_tags")
|
|
430
|
+
config_data_run = config_data.get(self.run, {})
|
|
431
|
+
first_run_tag = first_run_tags.get(self.run)
|
|
432
|
+
first_file_data, error = GraphUtils.safe_load_data(self.run, f"{first_run_tag}.vis")
|
|
433
|
+
if error:
|
|
434
|
+
logger.error(f"Error loading data: {error}")
|
|
435
|
+
return {'success': False, 'error': GraphUtils.t('loadConfigFailed')}
|
|
436
|
+
first_file_data['Colors'] = colors
|
|
437
|
+
config_data_run['colors'] = colors
|
|
438
|
+
config_data[self.run] = config_data_run
|
|
439
|
+
GraphState.set_global_value("config_data", config_data)
|
|
440
|
+
GraphUtils.safe_save_data(first_file_data, self.run, f"{first_run_tag}.vis")
|
|
441
|
+
return {'success': True, 'error': None, 'data': {}}
|
|
442
|
+
except Exception as e:
|
|
443
|
+
return {'success': False, 'error': GraphUtils.t('updateColorFailed'), 'data': None}
|
|
444
|
+
|
|
445
|
+
def save_matched_relations(self, meta_data):
|
|
446
|
+
run = meta_data.get('run')
|
|
447
|
+
tag = meta_data.get('tag')
|
|
448
|
+
config_data = GraphState.get_global_value("config_data")
|
|
449
|
+
# 匹配列表和未匹配列表
|
|
450
|
+
npu_match_nodes_list = config_data.get('manualMatchNodes', {})
|
|
451
|
+
try:
|
|
452
|
+
_, error = GraphUtils.safe_save_data(npu_match_nodes_list, run, f"{tag}.vis.config")
|
|
453
|
+
if error:
|
|
454
|
+
return {'success': False, 'error': error}
|
|
455
|
+
else:
|
|
456
|
+
return {'success': True, 'data': f"{tag}.vis.config"}
|
|
457
|
+
except (ValueError, IOError, PermissionError) as e:
|
|
458
|
+
return {'success': False, 'error': GraphUtils.t('operationFailed')}
|
|
459
|
+
|
|
460
|
+
def _generate_matched_result(self, match_result):
|
|
461
|
+
update_data = []
|
|
462
|
+
for item in match_result:
|
|
463
|
+
if item.get('success') is True:
|
|
464
|
+
for node in item.get('data', []):
|
|
465
|
+
update_data.append(node)
|
|
466
|
+
|
|
467
|
+
if len(update_data) > 0:
|
|
468
|
+
config_data = GraphState.get_global_value("config_data")
|
|
469
|
+
result = {
|
|
470
|
+
'success': True,
|
|
471
|
+
'data': {
|
|
472
|
+
'npuMatchNodes': config_data.get('npuMatchNodes', {}),
|
|
473
|
+
'benchMatchNodes': config_data.get('benchMatchNodes', {}),
|
|
474
|
+
'npuUnMatchNodes': config_data.get('npuUnMatchNodes', []),
|
|
475
|
+
'benchUnMatchNodes': config_data.get('benchUnMatchNodes', [])
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
else:
|
|
479
|
+
result = {'success': False, 'error': GraphUtils.t('selectedNodeCantMatched')}
|
|
480
|
+
return result
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# This file is part of the MindStudio project.
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co.,Ltd.
|
|
4
|
+
#
|
|
5
|
+
# MindStudio is licensed under Mulan PSL v2.
|
|
6
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
7
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
8
|
+
#
|
|
9
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
10
|
+
#
|
|
11
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
12
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
13
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
14
|
+
# See the Mulan PSL v2 for more details.
|
|
15
|
+
# -------------------------------------------------------------------------
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# This file is part of the MindStudio project.
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co.,Ltd.
|
|
4
|
+
#
|
|
5
|
+
# MindStudio is licensed under Mulan PSL v2.
|
|
6
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
7
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
8
|
+
#
|
|
9
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
10
|
+
#
|
|
11
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
12
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
13
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
14
|
+
# See the Mulan PSL v2 for more details.
|
|
15
|
+
# -------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
from enum import Enum
|
|
18
|
+
|
|
19
|
+
security_headers = {
|
|
20
|
+
"Content-Security-Policy": (
|
|
21
|
+
"default-src 'self'; connect-src 'self'; script-src 'unsafe-inline'; "
|
|
22
|
+
"style-src 'unsafe-inline'; img-src 'self' data:; font-src data:;"
|
|
23
|
+
),
|
|
24
|
+
"X-Frame-Options": "SAMEORIGIN",
|
|
25
|
+
"X-XSS-Protection": "1; mode=block",
|
|
26
|
+
"X-Content-Type-Options": "nosniff",
|
|
27
|
+
"Referrer-Policy": "no-referrer",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ADD_MATCH_KEYS = [
|
|
31
|
+
'MaxAbsErr',
|
|
32
|
+
'MinAbsErr',
|
|
33
|
+
'MeanAbsErr',
|
|
34
|
+
'NormAbsErr',
|
|
35
|
+
'MaxRelativeErr',
|
|
36
|
+
'MinRelativeErr',
|
|
37
|
+
'MeanRelativeErr',
|
|
38
|
+
'NormRelativeErr',
|
|
39
|
+
]
|
|
40
|
+
MAX_FILE_SIZE = 15 * 1024 * 1024 * 1024 # 最大文件大小限制
|
|
41
|
+
NPU_PREFIX = 'N___'
|
|
42
|
+
BENCH_PREFIX = 'B___'
|
|
43
|
+
FILE_NAME_REGEX = r'^[a-zA-Z0-9_\-\.]+$' # 文件名正则表达式
|
|
44
|
+
COLOR_PATTERN = r'^#[0-9A-Fa-f]{6}$'
|
|
45
|
+
# 未匹配节点值
|
|
46
|
+
UN_MATCHED_VALUE = -1
|
|
47
|
+
# 图类型
|
|
48
|
+
NPU = 'NPU'
|
|
49
|
+
BENCH = 'Bench'
|
|
50
|
+
SINGLE = 'Single'
|
|
51
|
+
|
|
52
|
+
# 前端节点类型
|
|
53
|
+
EXPAND_MODULE = 0
|
|
54
|
+
UNEXPAND_NODE = 1
|
|
55
|
+
|
|
56
|
+
# 权限码
|
|
57
|
+
PERM_GROUP_WRITE = 0o020
|
|
58
|
+
PERM_OTHER_WRITE = 0o002
|
|
59
|
+
|
|
60
|
+
# 后端节点类型
|
|
61
|
+
MODULE = 0
|
|
62
|
+
API = 1
|
|
63
|
+
MULTI_COLLECTION = 8
|
|
64
|
+
API_LIST = 9
|
|
65
|
+
|
|
66
|
+
# 计算指标
|
|
67
|
+
MAX_RELATIVE_ERR = "0"
|
|
68
|
+
MIN_RELATIVE_ERR = "1"
|
|
69
|
+
MEAN_RELATIVE_ERR = "2"
|
|
70
|
+
NORM_RELATIVE_ERR = "3"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Extension(Enum):
|
|
74
|
+
DB = '.vis.db'
|
|
75
|
+
JSON = '.vis'
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class DataType(Enum):
|
|
79
|
+
DB = 'db'
|
|
80
|
+
JSON = 'json'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# This file is part of the MindStudio project.
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co.,Ltd.
|
|
4
|
+
#
|
|
5
|
+
# MindStudio is licensed under Mulan PSL v2.
|
|
6
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
7
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
8
|
+
#
|
|
9
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
10
|
+
#
|
|
11
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
12
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
13
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
14
|
+
# See the Mulan PSL v2 for more details.
|
|
15
|
+
# -------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
from werkzeug import Response
|
|
19
|
+
from werkzeug.wrappers.request import Request
|
|
20
|
+
from ..utils.constant import security_headers
|
|
21
|
+
from ..utils.graph_utils import GraphUtils
|
|
22
|
+
from ..utils.global_state import GraphState
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def check_file_type(func):
|
|
26
|
+
def wrapper(*args, **kwargs):
|
|
27
|
+
try:
|
|
28
|
+
if len(args) <= 0:
|
|
29
|
+
raise RuntimeError('Illegal function call, at least 1 parameter is required but got 0')
|
|
30
|
+
request = args[0]
|
|
31
|
+
if not isinstance(request, Request):
|
|
32
|
+
raise RuntimeError('The request "parameter" is not in a format supported by werkzeug')
|
|
33
|
+
data = GraphUtils.safe_json_loads(request.get_data().decode('utf-8'), {})
|
|
34
|
+
meta_data = GraphUtils.safe_get_meta_data(data)
|
|
35
|
+
result = {'success': False, 'error': ''}
|
|
36
|
+
if meta_data is None or not isinstance(meta_data, dict):
|
|
37
|
+
result['error'] = GraphUtils.t('metaDataError')
|
|
38
|
+
return Response(json.dumps(result), content_type="application/json", headers=security_headers)
|
|
39
|
+
# 设置语言
|
|
40
|
+
GraphState.set_global_value('lang', meta_data.get('lang', 'zh-CN'))
|
|
41
|
+
except Exception as e:
|
|
42
|
+
result = {'success': False, 'error': str(e)}
|
|
43
|
+
return Response(json.dumps(result), content_type="application/json", headers=security_headers)
|
|
44
|
+
return func(*args, **kwargs)
|
|
45
|
+
|
|
46
|
+
return wrapper
|