mindstudio-probe 1.0.4__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/PKG-INFO +1 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/PKG-INFO +1 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/SOURCES.txt +15 -4
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/README.md +46 -16
- mindstudio-probe-1.1.0/msprobe/__init__.py +16 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/config.json +0 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/advisor/advisor.py +8 -8
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/advisor/advisor_const.py +6 -7
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/advisor/advisor_result.py +12 -12
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common/const.py +64 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common/exceptions.py +2 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common/file_utils.py +54 -9
- mindstudio-probe-1.1.0/msprobe/core/common/inplace_op_checker.py +38 -0
- mindstudio-probe-1.1.0/msprobe/core/common/inplace_ops.yaml +251 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common/log.py +21 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common/utils.py +153 -167
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/common_config.py +18 -25
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/acc_compare.py +209 -36
- mindstudio-probe-1.1.0/msprobe/core/compare/check.py +180 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/compare_cli.py +21 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/highlight.py +41 -5
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/multiprocessing_compute.py +33 -8
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/npy_compare.py +21 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/compare/utils.py +82 -48
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/data_collector.py +31 -32
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/data_processor/base.py +45 -22
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/data_processor/factory.py +20 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/data_processor/mindspore_processor.py +11 -5
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/data_processor/pytorch_processor.py +24 -7
- mindstudio-probe-1.1.0/msprobe/core/data_dump/json_writer.py +117 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/data_dump/scope.py +32 -16
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/grad_probe/constant.py +4 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/grad_probe/grad_compare.py +2 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/grad_probe/utils.py +16 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/01.installation.md +19 -9
- mindstudio-probe-1.1.0/msprobe/docs/02.config_introduction.md +137 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/03.config_examples.md +3 -13
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/04.acl_config_examples.md +11 -9
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/05.data_dump_PyTorch.md +140 -12
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/06.data_dump_MindSpore.md +47 -5
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/07.accuracy_checker_PyTorch.md +57 -34
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/08.accuracy_checker_online_PyTorch.md +51 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/09.accuracy_checker_MindSpore.md +8 -8
- mindstudio-probe-1.1.0/msprobe/docs/10.accuracy_compare_PyTorch.md +327 -0
- mindstudio-probe-1.1.0/msprobe/docs/11.accuracy_compare_MindSpore.md +333 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/13.overflow_check_MindSpore.md +1 -1
- mindstudio-probe-1.1.0/msprobe/docs/15.free_benchmarking_PyTorch.md +170 -0
- mindstudio-probe-1.1.0/msprobe/docs/16.free_benchmarking_MindSpore.md +140 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/17.grad_probe.md +14 -16
- mindstudio-probe-1.1.0/msprobe/docs/18.online_dispatch.md +89 -0
- mindstudio-probe-1.0.4/msprobe/docs/FAQ_PyTorch.md → mindstudio-probe-1.1.0/msprobe/docs/FAQ.md +22 -10
- mindstudio-probe-1.1.0/msprobe/docs/img/ms_dump.png +0 -0
- mindstudio-probe-1.1.0/msprobe/docs/img/ms_layer.png +0 -0
- mindstudio-probe-1.1.0/msprobe/docs/img/pt_dump.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/__init__.py +1 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/api_accuracy_checker.py +35 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/api_info.py +7 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/cell_processor.py +27 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/common/const.py +2 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/common/utils.py +18 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/compare/distributed_compare.py +9 -22
- mindstudio-probe-1.1.0/msprobe/mindspore/compare/layer_mapping.py +146 -0
- mindstudio-probe-1.1.0/msprobe/mindspore/compare/modify_mapping.py +107 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/compare/ms_compare.py +173 -35
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/compare/ms_graph_compare.py +27 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/debugger/debugger_config.py +16 -13
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/debugger/precision_debugger.py +37 -13
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/dump_tool_factory.py +16 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/hook_cell/api_registry.py +11 -1
- mindstudio-probe-1.1.0/msprobe/mindspore/dump/hook_cell/primitive_hooks.py +206 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/hook_cell/support_wrap_ops.yaml +82 -10
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/hook_cell/wrap_api.py +21 -13
- mindstudio-probe-1.1.0/msprobe/mindspore/dump/jit_dump.py +96 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/kernel_graph_dump.py +19 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/kernel_kbyk_dump.py +19 -4
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/api_pynative_self_check.py +19 -4
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/common/config.py +27 -0
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/common/handler_params.py +32 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/common/utils.py +19 -5
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/decorator/dec_forward.py +16 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/decorator/decorator_factory.py +18 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/handler/base_handler.py +18 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/handler/check_handler.py +18 -3
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/handler/fix_handler.py +15 -0
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/handler/handler_factory.py +36 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/perturbation/add_noise.py +22 -7
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/perturbation/base_perturbation.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/perturbation/bit_noise.py +22 -7
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/perturbation/exchange_value.py +77 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/perturbation/improve_precision.py +18 -4
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/perturbation/no_change.py +27 -0
- mindstudio-probe-1.1.0/msprobe/mindspore/free_benchmark/perturbation/perturbation_factory.py +44 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/self_check_tool_factory.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/global_context.py +18 -8
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/overflow_check/kernel_graph_overflow_check.py +20 -4
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/overflow_check/overflow_check_tool_factory.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/service.py +42 -123
- mindstudio-probe-1.1.0/msprobe/pytorch/__init__.py +23 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/common/config.py +19 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/common/utils.py +53 -21
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/algorithm.py +19 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/api_precision_compare.py +47 -21
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/compare.py +51 -21
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/compare_column.py +23 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/compare_utils.py +28 -8
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/config.yaml +1 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/data_generate.py +67 -32
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py +26 -5
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/run_overflow_check.py +19 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/run_ut.py +51 -125
- mindstudio-probe-1.1.0/msprobe/pytorch/api_accuracy_checker/run_ut/run_ut_utils.py +213 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/attl.py +21 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/client.py +78 -33
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/device_dispatch.py +27 -4
- mindstudio-probe-1.1.0/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/dump_dispatch.py +110 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/server.py +36 -11
- mindstudio-probe-1.1.0/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/torch_ops_config.yaml +63 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/utils.py +44 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/bench_functions/__init__.py +30 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/apply_adam_w.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/confusion_transpose.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/fast_gelu.py +15 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/bench_functions/layer_norm_eval.py +21 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/bench_functions/linear.py +27 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/matmul_backward.py +21 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/npu_fusion_attention.py +180 -151
- mindstudio-probe-1.1.0/msprobe/pytorch/bench_functions/rms_norm.py +30 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/rotary_mul.py +28 -9
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/scaled_mask_softmax.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/bench_functions/swiglu.py +20 -5
- mindstudio-probe-1.1.0/msprobe/pytorch/common/__init__.py +17 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/common/log.py +33 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/common/parse_json.py +26 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/common/utils.py +40 -35
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/compare/distributed_compare.py +11 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/compare/match.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/compare/pt_compare.py +38 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/debugger/debugger_config.py +52 -39
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/debugger/precision_debugger.py +72 -24
- mindstudio-probe-1.1.0/msprobe/pytorch/free_benchmark/__init__.py +23 -0
- mindstudio-probe-1.1.0/msprobe/pytorch/free_benchmark/common/enums.py +65 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/common/params.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/common/utils.py +17 -1
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/compare/grad_saver.py +28 -7
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/compare/single_benchmark.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/main.py +19 -4
- mindstudio-probe-1.1.0/msprobe/pytorch/free_benchmark/perturbed_layers/base_layer.py +28 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/layer_factory.py +19 -4
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/add_noise.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/bit_noise.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/change_value.py +26 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/improve_precision.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/no_change.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/npu_base_layser.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/run_cpu.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/base_handler.py +55 -16
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/check_handler.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/fix_handler.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/handler_factory.py +15 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py +19 -4
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/function_factory.py +17 -2
- mindstudio-probe-1.1.0/msprobe/pytorch/functional/module_dump.py +84 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/grad_probe/grad_stat_csv.py +2 -2
- mindstudio-probe-1.1.0/msprobe/pytorch/hook_module/__init__.py +16 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/api_registry.py +13 -8
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/hook_module.py +17 -19
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/utils.py +4 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_aten.py +12 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_distributed.py +6 -7
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_functional.py +10 -11
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_npu_custom.py +9 -17
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_tensor.py +4 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_torch.py +4 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/wrap_vf.py +4 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/module_processer.py +17 -2
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/compare.py +11 -12
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/single_compare.py +7 -7
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/torch_ops_config.yaml +8 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/utils.py +1 -4
- mindstudio-probe-1.1.0/msprobe/pytorch/parse.py +19 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/cli.py +5 -6
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/compare.py +9 -10
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/parse_tool.py +3 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/utils.py +28 -24
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/visualization.py +1 -1
- mindstudio-probe-1.1.0/msprobe/pytorch/pt_config.py +317 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/service.py +97 -32
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/setup.py +8 -4
- mindstudio-probe-1.0.4/msprobe/__init__.py +0 -1
- mindstudio-probe-1.0.4/msprobe/core/compare/check.py +0 -95
- mindstudio-probe-1.0.4/msprobe/core/data_dump/json_writer.py +0 -96
- mindstudio-probe-1.0.4/msprobe/docs/02.config_introduction.md +0 -165
- mindstudio-probe-1.0.4/msprobe/docs/10.accuracy_compare_PyTorch.md +0 -245
- mindstudio-probe-1.0.4/msprobe/docs/11.accuracy_compare_MindSpore.md +0 -202
- mindstudio-probe-1.0.4/msprobe/docs/15.free_benchmarking_PyTorch.md +0 -164
- mindstudio-probe-1.0.4/msprobe/mindspore/dump/jit_dump.py +0 -72
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/common/config.py +0 -12
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/common/handler_params.py +0 -17
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/handler/handler_factory.py +0 -21
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/perturbation/exchange_value.py +0 -51
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/perturbation/no_change.py +0 -12
- mindstudio-probe-1.0.4/msprobe/mindspore/free_benchmark/perturbation/perturbation_factory.py +0 -29
- mindstudio-probe-1.0.4/msprobe/pytorch/__init__.py +0 -4
- mindstudio-probe-1.0.4/msprobe/pytorch/api_accuracy_checker/run_ut/run_ut_utils.py +0 -70
- mindstudio-probe-1.0.4/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/ssl_config.py +0 -10
- mindstudio-probe-1.0.4/msprobe/pytorch/bench_functions/__init__.py +0 -15
- mindstudio-probe-1.0.4/msprobe/pytorch/bench_functions/layer_norm_eval.py +0 -6
- mindstudio-probe-1.0.4/msprobe/pytorch/bench_functions/linear.py +0 -12
- mindstudio-probe-1.0.4/msprobe/pytorch/bench_functions/rms_norm.py +0 -15
- mindstudio-probe-1.0.4/msprobe/pytorch/common/__init__.py +0 -2
- mindstudio-probe-1.0.4/msprobe/pytorch/common/log.py +0 -21
- mindstudio-probe-1.0.4/msprobe/pytorch/free_benchmark/__init__.py +0 -8
- mindstudio-probe-1.0.4/msprobe/pytorch/free_benchmark/common/enums.py +0 -37
- mindstudio-probe-1.0.4/msprobe/pytorch/free_benchmark/perturbed_layers/base_layer.py +0 -13
- mindstudio-probe-1.0.4/msprobe/pytorch/functional/data_processor.py +0 -0
- mindstudio-probe-1.0.4/msprobe/pytorch/functional/dump_module.py +0 -39
- mindstudio-probe-1.0.4/msprobe/pytorch/hook_module/__init__.py +0 -1
- mindstudio-probe-1.0.4/msprobe/pytorch/parse.py +0 -4
- mindstudio-probe-1.0.4/msprobe/pytorch/pt_config.py +0 -188
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/LICENSE +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/MANIFEST.in +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/dependency_links.txt +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/entry_points.txt +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/not-zip-safe +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/requires.txt +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/mindstudio_probe.egg-info/top_level.txt +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/core/grad_probe/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/12.overflow_check_PyTorch.md +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/14.data_parse_PyTorch.md +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/S02.report_free_benchmarking_validation_performance_baseline.md +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/BLOOM-7B_1.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/BLOOM-7B_2.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/BLOOM-7B_3.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/BLOOM-7B_4.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_1.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_2.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_3.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_4.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_5.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_6.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_7.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/GPT-3_8.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/YOLOV5S_1.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/YOLOV5S_2.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/accuracy_checking_details.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/accuracy_checking_result.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/api_precision_compare_details.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/api_precision_compare_result.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/auto_analyze_log.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/compare_result_pkl.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/compare_result_pkl_md5.png.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/cpu_info.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/free_benchmark.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/free_benchmark_framework.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/grad_probe_image-1.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/grad_probe_image-2.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/grad_probe_image-3.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/grad_probe_image-4.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/grad_probe_image.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/docs/img/module_compare.png +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/api_runner.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/base_compare_algorithm.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/cmd_parser.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/compute_element.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/main.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/type_mapping.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/api_accuracy_checker/utils.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/common/log.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/compare/ms_to_pt_api.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/debugger/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/dump/hook_cell/hook_cell.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/common/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/data/support_wrap_ops.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/decorator/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/free_benchmark/handler/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/grad_analyzer.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/grad_monitor.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/grad_stat_csv.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/hook.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/grad_probe/utils.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/ms_config.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/overflow_check/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/runtime.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/mindspore/task_handler_factory.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/msprobe.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/.keep +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/common/.keep +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/common/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/api_precision_standard.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/compare/api_precision_threshold.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/.keep +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/run_ut/torch_ut_setting.json +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/common/compare_script.template +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/compare/mapping.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/debugger/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/common/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/common/constant.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/common/counter.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/perturbed_layers/npu/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/free_benchmark/result_handlers/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/functional/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/grad_probe/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/grad_probe/grad_monitor.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/hook_module/support_wrap_ops.yaml +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/dispatch.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/online_dispatch/dump_compare.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/__init__.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/config.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/file_desc.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/interactive_cli.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/msprobe/pytorch/parse_tool/lib/parse_exception.py +0 -0
- {mindstudio-probe-1.0.4 → mindstudio-probe-1.1.0}/setup.cfg +0 -0
|
@@ -20,6 +20,8 @@ msprobe/core/advisor/advisor_result.py
|
|
|
20
20
|
msprobe/core/common/const.py
|
|
21
21
|
msprobe/core/common/exceptions.py
|
|
22
22
|
msprobe/core/common/file_utils.py
|
|
23
|
+
msprobe/core/common/inplace_op_checker.py
|
|
24
|
+
msprobe/core/common/inplace_ops.yaml
|
|
23
25
|
msprobe/core/common/log.py
|
|
24
26
|
msprobe/core/common/utils.py
|
|
25
27
|
msprobe/core/compare/acc_compare.py
|
|
@@ -55,8 +57,10 @@ msprobe/docs/12.overflow_check_PyTorch.md
|
|
|
55
57
|
msprobe/docs/13.overflow_check_MindSpore.md
|
|
56
58
|
msprobe/docs/14.data_parse_PyTorch.md
|
|
57
59
|
msprobe/docs/15.free_benchmarking_PyTorch.md
|
|
60
|
+
msprobe/docs/16.free_benchmarking_MindSpore.md
|
|
58
61
|
msprobe/docs/17.grad_probe.md
|
|
59
|
-
msprobe/docs/
|
|
62
|
+
msprobe/docs/18.online_dispatch.md
|
|
63
|
+
msprobe/docs/FAQ.md
|
|
60
64
|
msprobe/docs/S02.report_free_benchmarking_validation_performance_baseline.md
|
|
61
65
|
msprobe/docs/img/BLOOM-7B_1.png
|
|
62
66
|
msprobe/docs/img/BLOOM-7B_2.png
|
|
@@ -88,6 +92,9 @@ msprobe/docs/img/grad_probe_image-3.png
|
|
|
88
92
|
msprobe/docs/img/grad_probe_image-4.png
|
|
89
93
|
msprobe/docs/img/grad_probe_image.png
|
|
90
94
|
msprobe/docs/img/module_compare.png
|
|
95
|
+
msprobe/docs/img/ms_dump.png
|
|
96
|
+
msprobe/docs/img/ms_layer.png
|
|
97
|
+
msprobe/docs/img/pt_dump.png
|
|
91
98
|
msprobe/mindspore/__init__.py
|
|
92
99
|
msprobe/mindspore/cell_processor.py
|
|
93
100
|
msprobe/mindspore/ms_config.py
|
|
@@ -108,6 +115,8 @@ msprobe/mindspore/common/const.py
|
|
|
108
115
|
msprobe/mindspore/common/log.py
|
|
109
116
|
msprobe/mindspore/common/utils.py
|
|
110
117
|
msprobe/mindspore/compare/distributed_compare.py
|
|
118
|
+
msprobe/mindspore/compare/layer_mapping.py
|
|
119
|
+
msprobe/mindspore/compare/modify_mapping.py
|
|
111
120
|
msprobe/mindspore/compare/ms_compare.py
|
|
112
121
|
msprobe/mindspore/compare/ms_graph_compare.py
|
|
113
122
|
msprobe/mindspore/compare/ms_to_pt_api.yaml
|
|
@@ -121,6 +130,7 @@ msprobe/mindspore/dump/kernel_graph_dump.py
|
|
|
121
130
|
msprobe/mindspore/dump/kernel_kbyk_dump.py
|
|
122
131
|
msprobe/mindspore/dump/hook_cell/api_registry.py
|
|
123
132
|
msprobe/mindspore/dump/hook_cell/hook_cell.py
|
|
133
|
+
msprobe/mindspore/dump/hook_cell/primitive_hooks.py
|
|
124
134
|
msprobe/mindspore/dump/hook_cell/support_wrap_ops.yaml
|
|
125
135
|
msprobe/mindspore/dump/hook_cell/wrap_api.py
|
|
126
136
|
msprobe/mindspore/free_benchmark/__init__.py
|
|
@@ -189,8 +199,10 @@ msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/__init__.py
|
|
|
189
199
|
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/attl.py
|
|
190
200
|
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/client.py
|
|
191
201
|
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/device_dispatch.py
|
|
202
|
+
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/dump_dispatch.py
|
|
192
203
|
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/server.py
|
|
193
|
-
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/
|
|
204
|
+
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/torch_ops_config.yaml
|
|
205
|
+
msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/utils.py
|
|
194
206
|
msprobe/pytorch/bench_functions/__init__.py
|
|
195
207
|
msprobe/pytorch/bench_functions/apply_adam_w.py
|
|
196
208
|
msprobe/pytorch/bench_functions/confusion_transpose.py
|
|
@@ -243,8 +255,7 @@ msprobe/pytorch/free_benchmark/result_handlers/fix_handler.py
|
|
|
243
255
|
msprobe/pytorch/free_benchmark/result_handlers/handler_factory.py
|
|
244
256
|
msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py
|
|
245
257
|
msprobe/pytorch/functional/__init__.py
|
|
246
|
-
msprobe/pytorch/functional/
|
|
247
|
-
msprobe/pytorch/functional/dump_module.py
|
|
258
|
+
msprobe/pytorch/functional/module_dump.py
|
|
248
259
|
msprobe/pytorch/grad_probe/__init__.py
|
|
249
260
|
msprobe/pytorch/grad_probe/grad_monitor.py
|
|
250
261
|
msprobe/pytorch/grad_probe/grad_stat_csv.py
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# 📖 msprobe 使用手册
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**msprobe** 是 MindStudio Training Tools 工具链下精度调试部分的工具包。主要包括精度预检、溢出检测和精度比对等功能,目前适配 [PyTorch](https://pytorch.org/) 和 [MindSpore](https://www.mindspore.cn/) 框架。这些子工具侧重不同的训练场景,可以定位模型训练中的精度问题。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
为方便使用,本工具提供了统一、简易的程序接口:**PrecisionDebugger**。以 PyTorch 框架为例,通过以下示例模板和 **config.json** 可以轻松使用各种功能。
|
|
10
10
|
|
|
11
11
|
```python
|
|
12
12
|
from msprobe.pytorch import PrecisionDebugger
|
|
@@ -19,7 +19,19 @@ debugger.stop() # 一般在训练循环末尾结束工具
|
|
|
19
19
|
debugger.step() # 在训练循环的最后需要重置工具,非循环场景不需要
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
此外,根据以下规则,可以通过环境变量设置日志级别。
|
|
23
|
+
- MSPROBE_LOG_LEVEL=4,不打印任何日志;
|
|
24
|
+
- MSPROBE_LOG_LEVEL=3,仅打印 ERROR;
|
|
25
|
+
- MSPROBE_LOG_LEVEL=2,仅打印 WARNING、ERROR;
|
|
26
|
+
- MSPROBE_LOG_LEVEL=1,仅打印 INFO、WARNING、ERROR(默认配置);
|
|
27
|
+
- MSPROBE_LOG_LEVEL=0,打印 DEBUG、INFO、WARNING、ERROR。
|
|
28
|
+
|
|
29
|
+
例如在 shell 脚本:
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
export MSPROBE_LOG_LEVEL={x}
|
|
33
|
+
```
|
|
34
|
+
**config.json** 的配置要求和各功能具体的使用指导详见后续章节。
|
|
23
35
|
|
|
24
36
|
## ⚙️ [安装](./docs/01.installation.md)
|
|
25
37
|
|
|
@@ -67,9 +79,9 @@ MindSpore 动态图场景的[离线预检](./docs/09.accuracy_checker_MindSpore.
|
|
|
67
79
|
|
|
68
80
|
### 6 无标杆比对
|
|
69
81
|
|
|
70
|
-
[PyTorch 场景的无标杆比对](./docs/15.free_benchmarking_PyTorch.md)
|
|
82
|
+
[PyTorch 场景的无标杆比对](./docs/15.free_benchmarking_PyTorch.md)
|
|
71
83
|
|
|
72
|
-
[MindSpore 场景的无标杆比对](./docs/16.
|
|
84
|
+
[MindSpore 场景的无标杆比对](./docs/16.free_benchmarking_MindSpore.md)
|
|
73
85
|
|
|
74
86
|
### 7 梯度状态监测
|
|
75
87
|
|
|
@@ -77,25 +89,43 @@ MindSpore 动态图场景的[离线预检](./docs/09.accuracy_checker_MindSpore.
|
|
|
77
89
|
|
|
78
90
|
[兼容 PyTorch 和 MindSpore 框架的梯度监测](./docs/17.grad_probe.md)
|
|
79
91
|
|
|
92
|
+
### 8 在线精度比对
|
|
93
|
+
|
|
94
|
+
在线精度比对是实现在PyTorch训练过程中直接完成精度比对并输出比对结果的功能,是NPU与CPU之间的精度比对。
|
|
95
|
+
|
|
96
|
+
[PyTorch 场景的在线精度比对](./docs/18.online_dispatch.md)
|
|
97
|
+
|
|
80
98
|
## 🌟 新版本特性
|
|
81
99
|
|
|
100
|
+
若查看历史版本特性,请点击[安装](./docs/01.installation.md)。
|
|
101
|
+
|
|
102
|
+
【数据采集】
|
|
103
|
+
- 支持 config.json 中的 step 传入范围;
|
|
104
|
+
- 优化了指定 step 的机制,指定 step 结束后工具不再采集数据,但训练会继续运行。工具结束运行后,日志提示信息如下:
|
|
105
|
+
```bash
|
|
106
|
+
****************************************
|
|
107
|
+
* msprobe ends successfully. *
|
|
108
|
+
****************************************
|
|
109
|
+
```
|
|
110
|
+
注:在多卡场景,每张卡进程训练到指定 step 之后都会打印一次上述信息。
|
|
111
|
+
|
|
82
112
|
【精度预检】
|
|
83
|
-
-
|
|
84
|
-
- 支持随机生成模式和真实数据模式。
|
|
85
|
-
- 单 API 测试,排除整网中的累计误差问题。
|
|
113
|
+
- 在 PyTorch 场景,支持部分 NPU 融合算子预检。
|
|
86
114
|
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
115
|
+
【精度比对】
|
|
116
|
+
- 解决了使用 MindSpore 需要安装 PyTorch 的问题。
|
|
117
|
+
|
|
118
|
+
【无标杆比对】
|
|
119
|
+
- 补充在 PyTorch 场景的性能基线报告;
|
|
120
|
+
- 支持 MindSpore 场景的 change_value 扰动模式。
|
|
90
121
|
|
|
91
122
|
## 📑 补充材料
|
|
92
123
|
|
|
93
|
-
[
|
|
124
|
+
[无标杆比对功能在 PyTorch 场景的性能基线报告](./docs/S02.report_free_benchmarking_validation_performance_baseline.md)
|
|
94
125
|
|
|
95
|
-
|
|
126
|
+
## ❗ 免责声明
|
|
127
|
+
本工具建议执行用户与安装用户保持一致,如果您要使用 root 执行,请自行关注 root 高权限触及的安全风险。
|
|
96
128
|
|
|
97
129
|
## ❓ FAQ
|
|
98
130
|
|
|
99
131
|
[FAQ for PyTorch](./docs/FAQ_PyTorch.md)
|
|
100
|
-
|
|
101
|
-
FAQ for MindSpore
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) 2024-2024, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from msprobe.core.grad_probe.grad_compare import GradComparator
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2022-2024, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,7 +12,6 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
"""
|
|
17
15
|
|
|
18
16
|
import os
|
|
19
17
|
|
|
@@ -24,15 +22,17 @@ from msprobe.core.common.utils import CompareException
|
|
|
24
22
|
from msprobe.core.common.file_utils import FileChecker
|
|
25
23
|
from msprobe.core.common.const import Const, CompareConst, FileCheckConst
|
|
26
24
|
|
|
25
|
+
|
|
27
26
|
class Advisor:
|
|
28
27
|
"""
|
|
29
28
|
Class for generate advisor
|
|
30
29
|
"""
|
|
31
30
|
|
|
32
|
-
def __init__(self, input_data, out_path=""):
|
|
31
|
+
def __init__(self, input_data, out_path="", suffix=""):
|
|
33
32
|
self.input_data = input_data
|
|
34
33
|
self.out_path = os.path.realpath(out_path)
|
|
35
34
|
self.file_type = None
|
|
35
|
+
self.suffix = suffix
|
|
36
36
|
|
|
37
37
|
@staticmethod
|
|
38
38
|
def deterministic_advisor(message, node_name):
|
|
@@ -103,7 +103,7 @@ class Advisor:
|
|
|
103
103
|
else:
|
|
104
104
|
result = self.gen_advisor_result(failing_data)
|
|
105
105
|
message_list = result.print_advisor_log()
|
|
106
|
-
result.gen_summary_file(self.out_path, message_list)
|
|
106
|
+
result.gen_summary_file(self.out_path, message_list, suffix=self.suffix)
|
|
107
107
|
|
|
108
108
|
def _parse_input_data(self):
|
|
109
109
|
data_columns = self.input_data.columns.values
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2022-2024, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,7 +12,6 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
"""
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
class AdvisorConst:
|
|
@@ -35,7 +33,8 @@ class AdvisorConst:
|
|
|
35
33
|
# advisor message
|
|
36
34
|
NO_ERR_SUGGEST = "All data in comparison result meets the accuracy requirements."
|
|
37
35
|
FORWARD_INPUT_SUGGEST = "1. Analyze the model to view the input source.\n" \
|
|
38
|
-
"2. Check whether an inplace API causes the output result to overwrite the input result.
|
|
36
|
+
"2. Check whether an inplace API causes the output result to overwrite the input result. "\
|
|
37
|
+
"That is, the fault is actually caused by a computation error.\n" \
|
|
39
38
|
"3. The fault may be caused by memory corruption and further analysis is required."
|
|
40
39
|
FORWARD_OUTPUT_SUGGEST = "This is a forward API computation error. Check the computation implementation."
|
|
41
40
|
BACKWARD_INPUT_SUGGEST = "Check whether the forward computation result is affected."
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2022-2024, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,13 +12,12 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
"""
|
|
17
15
|
import os
|
|
18
16
|
import time
|
|
19
17
|
|
|
20
18
|
from msprobe.core.advisor.advisor_const import AdvisorConst
|
|
21
19
|
from msprobe.core.common.log import logger
|
|
22
|
-
from msprobe.core.common.const import
|
|
20
|
+
from msprobe.core.common.const import FileCheckConst
|
|
23
21
|
from msprobe.core.common.file_utils import change_mode, FileOpen
|
|
24
22
|
|
|
25
23
|
|
|
@@ -34,8 +32,8 @@ class AdvisorResult:
|
|
|
34
32
|
self.advisor_message = message
|
|
35
33
|
|
|
36
34
|
@staticmethod
|
|
37
|
-
def gen_summary_file(out_path, message_list):
|
|
38
|
-
file_name = '
|
|
35
|
+
def gen_summary_file(out_path, message_list, suffix):
|
|
36
|
+
file_name = 'advisor{}_{}.txt'.format(suffix, time.strftime("%Y%m%d%H%M%S", time.localtime(time.time())))
|
|
39
37
|
result_file = os.path.join(out_path, file_name)
|
|
40
38
|
try:
|
|
41
39
|
with FileOpen(result_file, 'w+') as output_file:
|
|
@@ -50,9 +48,11 @@ class AdvisorResult:
|
|
|
50
48
|
|
|
51
49
|
def print_advisor_log(self):
|
|
52
50
|
logger.info("The summary of the expert advice is as follows: ")
|
|
53
|
-
message_list = [
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
message_list = [
|
|
52
|
+
AdvisorConst.LINE + AdvisorConst.COLON + str(self.line),
|
|
53
|
+
AdvisorConst.SUSPECT_NODES + AdvisorConst.COLON + self.suspect_node,
|
|
54
|
+
AdvisorConst.ADVISOR_SUGGEST + AdvisorConst.COLON + self.advisor_message
|
|
55
|
+
]
|
|
56
56
|
for message in message_list:
|
|
57
57
|
logger.info(message)
|
|
58
58
|
return message_list
|
|
@@ -14,11 +14,13 @@ class Const:
|
|
|
14
14
|
REGEX_PREFIX_MAX_LENGTH = 20
|
|
15
15
|
REGEX_PREFIX_PATTERN = r"^[a-zA-Z0-9_-]+$"
|
|
16
16
|
FILE_PATTERN = r'^[a-zA-Z0-9_./-]+$'
|
|
17
|
+
STRING_BLACKLIST = r"^[+-=%@\+\-=%@]|;[+-=%@\+\-=%@]"
|
|
17
18
|
COMMA = ","
|
|
18
19
|
FLOAT_EPSILON = np.finfo(float).eps
|
|
19
20
|
OFF = 'OFF'
|
|
20
21
|
BACKWARD = 'backward'
|
|
21
22
|
FORWARD = 'forward'
|
|
23
|
+
JIT = 'Jit'
|
|
22
24
|
PRIMITIVE_PREFIX = 'Primitive'
|
|
23
25
|
DEFAULT_LIST = []
|
|
24
26
|
DEFAULT_PATH = './'
|
|
@@ -30,6 +32,7 @@ class Const:
|
|
|
30
32
|
FOUR_SEGMENT = 4
|
|
31
33
|
SIX_SEGMENT = 6
|
|
32
34
|
SEVEN_SEGMENT = 7
|
|
35
|
+
MAX_DEPTH = 10
|
|
33
36
|
|
|
34
37
|
# dump mode
|
|
35
38
|
ALL = "all"
|
|
@@ -78,6 +81,7 @@ class Const:
|
|
|
78
81
|
RUN_UT = "run_ut"
|
|
79
82
|
GRAD_PROBE = "grad_probe"
|
|
80
83
|
TASK_LIST = [TENSOR, STATISTICS, OVERFLOW_CHECK, FREE_BENCHMARK, RUN_UT, GRAD_PROBE]
|
|
84
|
+
DUMP_DATA_COLLECTION_LIST = [STATISTICS, TENSOR]
|
|
81
85
|
LEVEL_L0 = "L0"
|
|
82
86
|
LEVEL_L1 = "L1"
|
|
83
87
|
LEVEL_L2 = "L2"
|
|
@@ -100,6 +104,30 @@ class Const:
|
|
|
100
104
|
CUDA_LOWERCASE = 'cuda'
|
|
101
105
|
DISTRIBUTED = 'Distributed'
|
|
102
106
|
|
|
107
|
+
# struct json param
|
|
108
|
+
ORIGIN_DATA = "origin_data"
|
|
109
|
+
SCOPE = "scope"
|
|
110
|
+
STACK = "stack"
|
|
111
|
+
|
|
112
|
+
ATEN = "Aten"
|
|
113
|
+
MODULE_WHITE_LIST = ["torch", "numpy"]
|
|
114
|
+
|
|
115
|
+
FUNC_SKIP_LIST = ["construct", "__call__"]
|
|
116
|
+
|
|
117
|
+
FILE_SKIP_LIST = ["site-packages/mindspore", "package/mindspore", "msprobe", "site-packages/torch", "package/torch"]
|
|
118
|
+
|
|
119
|
+
STACK_FILE_INDEX = 0
|
|
120
|
+
|
|
121
|
+
STACK_FUNC_INDEX = 2
|
|
122
|
+
|
|
123
|
+
STACK_FUNC_ELE_INDEX = 1
|
|
124
|
+
|
|
125
|
+
CONSTRUCT_NAME_INDEX = -3
|
|
126
|
+
|
|
127
|
+
NAME_FIRST_POSSIBLE_INDEX = -4
|
|
128
|
+
|
|
129
|
+
NAME_SECOND_POSSIBLE_INDEX = -5
|
|
130
|
+
|
|
103
131
|
INPLACE_LIST = [
|
|
104
132
|
"broadcast", "all_reduce", "reduce", "all_gather", "gather", "scatter", "reduce_scatter",
|
|
105
133
|
"_reduce_scatter_base", "_all_gather_base", "send", "recv", "irecv", "isend", "all_to_all_single", "all_to_all",
|
|
@@ -114,6 +142,23 @@ class Const:
|
|
|
114
142
|
"int32_to_int64": ["cross_entropy"]
|
|
115
143
|
}
|
|
116
144
|
|
|
145
|
+
FILL_CHAR_NUMS = 50
|
|
146
|
+
TOOL_ENDS_SUCCESSFULLY = f"{TOOL_NAME} ends successfully."
|
|
147
|
+
WITHOUT_CALL_STACK = "The call stack retrieval failed."
|
|
148
|
+
|
|
149
|
+
STEP = "step"
|
|
150
|
+
RANK = "rank"
|
|
151
|
+
HYPHEN = "-"
|
|
152
|
+
STEP_RANK_MAXIMUM_RANGE = [int(0), int(1e6)]
|
|
153
|
+
|
|
154
|
+
# data type const
|
|
155
|
+
FLOAT16 = "Float16"
|
|
156
|
+
FLOAT32 = "Float32"
|
|
157
|
+
BFLOAT16 = "BFloat16"
|
|
158
|
+
TORCH_FLOAT16 = "torch.float16"
|
|
159
|
+
TORCH_FLOAT32 = "torch.float32"
|
|
160
|
+
TORCH_BFLOAT16 = "torch.bfloat16"
|
|
161
|
+
|
|
117
162
|
|
|
118
163
|
class CompareConst:
|
|
119
164
|
"""
|
|
@@ -159,6 +204,7 @@ class CompareConst:
|
|
|
159
204
|
INPUT_STRUCT = "input_struct"
|
|
160
205
|
OUTPUT_STRUCT = "output_struct"
|
|
161
206
|
SUMMARY = "summary"
|
|
207
|
+
MAX_EXCEL_LENGTH = 1048576
|
|
162
208
|
|
|
163
209
|
COMPARE_RESULT_HEADER = [
|
|
164
210
|
NPU_NAME, BENCH_NAME, NPU_DTYPE, BENCH_DTYPE, NPU_SHAPE, BENCH_SHAPE, COSINE, MAX_ABS_ERR, MAX_RELATIVE_ERR,
|
|
@@ -197,6 +243,8 @@ class CompareConst:
|
|
|
197
243
|
ERROR = 'error'
|
|
198
244
|
SKIP = 'SKIP'
|
|
199
245
|
N_A = 'N/A'
|
|
246
|
+
INF = 'inf'
|
|
247
|
+
NEG_INF = '-inf'
|
|
200
248
|
BFLOAT16_MIN = -3.3895313892515355e+38
|
|
201
249
|
BFLOAT16_MAX = 3.3895313892515355e+38
|
|
202
250
|
BFLOAT16_EPS = 3.90625e-3 # 2 ** -8
|
|
@@ -274,7 +322,8 @@ class FileCheckConst:
|
|
|
274
322
|
MAX_JSON_SIZE = 1073741824 # 1 * 1024 * 1024 * 1024
|
|
275
323
|
MAX_PT_SIZE = 10737418240 # 10 * 1024 * 1024 * 1024
|
|
276
324
|
MAX_CSV_SIZE = 1073741824 # 1 * 1024 * 1024 * 1024
|
|
277
|
-
MAX_YAML_SIZE = 1048576 #
|
|
325
|
+
MAX_YAML_SIZE = 1048576 # 1 * 1024 * 1024
|
|
326
|
+
COMMOM_FILE_SIZE = 1048576 # 1 * 1024 * 1024
|
|
278
327
|
DIR = "dir"
|
|
279
328
|
FILE = "file"
|
|
280
329
|
DATA_DIR_AUTHORITY = 0o750
|
|
@@ -287,6 +336,7 @@ class FileCheckConst:
|
|
|
287
336
|
CSV_SUFFIX: MAX_CSV_SIZE,
|
|
288
337
|
YAML_SUFFIX: MAX_YAML_SIZE
|
|
289
338
|
}
|
|
339
|
+
CSV_BLACK_LIST = r'^[+-=%@\+\-=%@]|;[+-=%@\+\-=%@]'
|
|
290
340
|
|
|
291
341
|
|
|
292
342
|
class OverflowConst:
|
|
@@ -329,11 +379,22 @@ class MsgConst:
|
|
|
329
379
|
"""
|
|
330
380
|
Class for log messages const
|
|
331
381
|
"""
|
|
332
|
-
CLEAR_SYMBOL = "\033[K"
|
|
333
382
|
MSPROBE_LOG_LEVEL = "MSPROBE_LOG_LEVEL"
|
|
334
|
-
|
|
383
|
+
LOG_LEVEL_ENUM = ["0", "1", "2", "3", "4"]
|
|
384
|
+
LOG_LEVEL = ["DEBUG", "INFO", "WARNING", "ERROR"]
|
|
385
|
+
class LogLevel:
|
|
386
|
+
class DEBUG:
|
|
387
|
+
value = 0
|
|
388
|
+
class INFO:
|
|
389
|
+
value = 1
|
|
390
|
+
class WARNING:
|
|
391
|
+
value = 2
|
|
392
|
+
class ERROR:
|
|
393
|
+
value = 3
|
|
335
394
|
SPECIAL_CHAR = ["\n", "\r", "\u007F", "\b", "\f", "\t", "\u000B", "%08", "%0a", "%0b", "%0c", "%0d", "%7f"]
|
|
336
395
|
|
|
396
|
+
NOT_CREATED_INSTANCE = "PrecisionDebugger instance is not created."
|
|
397
|
+
|
|
337
398
|
|
|
338
399
|
class GraphMode:
|
|
339
400
|
NPY_MODE = "NPY_MODE"
|
|
@@ -13,8 +13,8 @@ class MsprobeException(CodedException):
|
|
|
13
13
|
OVERFLOW_NUMS_ERROR = 1
|
|
14
14
|
|
|
15
15
|
err_strs = {
|
|
16
|
-
INVALID_PARAM_ERROR: "[msprobe] 无效参数:
|
|
17
|
-
OVERFLOW_NUMS_ERROR: "[msprobe] 超过预设溢出次数
|
|
16
|
+
INVALID_PARAM_ERROR: "[msprobe] 无效参数:",
|
|
17
|
+
OVERFLOW_NUMS_ERROR: "[msprobe] 超过预设溢出次数 当前溢出次数:"
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
@@ -22,6 +22,7 @@ import re
|
|
|
22
22
|
import shutil
|
|
23
23
|
import yaml
|
|
24
24
|
import numpy as np
|
|
25
|
+
import pandas as pd
|
|
25
26
|
|
|
26
27
|
from msprobe.core.common.log import logger
|
|
27
28
|
from msprobe.core.common.exceptions import FileCheckException
|
|
@@ -187,7 +188,7 @@ def check_other_user_writable(path):
|
|
|
187
188
|
|
|
188
189
|
def check_path_owner_consistent(path):
|
|
189
190
|
file_owner = os.stat(path).st_uid
|
|
190
|
-
if file_owner != os.getuid():
|
|
191
|
+
if file_owner != os.getuid() and os.getuid() != 0:
|
|
191
192
|
logger.error('The file path %s may be insecure because is does not belong to you.' % path)
|
|
192
193
|
raise FileCheckException(FileCheckException.FILE_PERMISSION_ERROR)
|
|
193
194
|
|
|
@@ -214,7 +215,9 @@ def check_common_file_size(file_path):
|
|
|
214
215
|
for suffix, max_size in FileCheckConst.FILE_SIZE_DICT.items():
|
|
215
216
|
if file_path.endswith(suffix):
|
|
216
217
|
check_file_size(file_path, max_size)
|
|
217
|
-
|
|
218
|
+
return
|
|
219
|
+
check_file_size(file_path, FileCheckConst.COMMOM_FILE_SIZE)
|
|
220
|
+
|
|
218
221
|
|
|
219
222
|
|
|
220
223
|
def check_file_suffix(file_path, file_suffix):
|
|
@@ -322,7 +325,7 @@ def check_file_type(path):
|
|
|
322
325
|
elif os.path.isfile(path):
|
|
323
326
|
return FileCheckConst.FILE
|
|
324
327
|
else:
|
|
325
|
-
logger.error('
|
|
328
|
+
logger.error(f'{path} does not exist, please check!')
|
|
326
329
|
raise FileCheckException(FileCheckException.INVALID_FILE_ERROR)
|
|
327
330
|
|
|
328
331
|
|
|
@@ -338,10 +341,10 @@ def load_yaml(yaml_path):
|
|
|
338
341
|
return yaml_data
|
|
339
342
|
|
|
340
343
|
|
|
341
|
-
def load_npy(filepath
|
|
344
|
+
def load_npy(filepath):
|
|
342
345
|
check_file_or_directory_path(filepath)
|
|
343
346
|
try:
|
|
344
|
-
npy = np.load(filepath
|
|
347
|
+
npy = np.load(filepath)
|
|
345
348
|
except Exception as e:
|
|
346
349
|
logger.error(f"The numpy file failed to load. Please check the path: {filepath}.")
|
|
347
350
|
raise RuntimeError(f"Load numpy file {filepath} failed.") from e
|
|
@@ -374,6 +377,20 @@ def save_json(json_path, data, indent=None):
|
|
|
374
377
|
change_mode(json_path, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
375
378
|
|
|
376
379
|
|
|
380
|
+
def save_yaml(yaml_path, data):
|
|
381
|
+
yaml_path = os.path.realpath(yaml_path)
|
|
382
|
+
check_path_before_create(yaml_path)
|
|
383
|
+
try:
|
|
384
|
+
with FileOpen(yaml_path, 'w') as f:
|
|
385
|
+
fcntl.flock(f, fcntl.LOCK_EX)
|
|
386
|
+
yaml.dump(data, f, sort_keys=False)
|
|
387
|
+
fcntl.flock(f, fcntl.LOCK_UN)
|
|
388
|
+
except Exception as e:
|
|
389
|
+
logger.error(f'Save yaml file "{os.path.basename(yaml_path)}" failed.')
|
|
390
|
+
raise RuntimeError(f"Save yaml file {yaml_path} failed.") from e
|
|
391
|
+
change_mode(yaml_path, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
392
|
+
|
|
393
|
+
|
|
377
394
|
def move_file(src_path, dst_path):
|
|
378
395
|
check_file_or_directory_path(src_path)
|
|
379
396
|
check_path_before_create(dst_path)
|
|
@@ -396,9 +413,9 @@ def save_npy(data, filepath):
|
|
|
396
413
|
change_mode(filepath, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
397
414
|
|
|
398
415
|
|
|
399
|
-
def save_npy_to_txt(
|
|
416
|
+
def save_npy_to_txt(data, dst_file='', align=0):
|
|
400
417
|
if os.path.exists(dst_file):
|
|
401
|
-
|
|
418
|
+
logger.info("Dst file %s exists, will not save new one." % dst_file)
|
|
402
419
|
return
|
|
403
420
|
shape = data.shape
|
|
404
421
|
data = data.flatten()
|
|
@@ -411,7 +428,7 @@ def save_npy_to_txt(self, data, dst_file='', align=0):
|
|
|
411
428
|
try:
|
|
412
429
|
np.savetxt(dst_file, data.reshape((-1, align)), delimiter=' ', fmt='%g')
|
|
413
430
|
except Exception as e:
|
|
414
|
-
|
|
431
|
+
logger.error("An unexpected error occurred: %s when savetxt to %s" % (str(e), dst_file))
|
|
415
432
|
change_mode(dst_file, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
416
433
|
|
|
417
434
|
|
|
@@ -431,7 +448,25 @@ def save_workbook(workbook, file_path):
|
|
|
431
448
|
change_mode(file_path, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
432
449
|
|
|
433
450
|
|
|
434
|
-
def write_csv(data, filepath, mode="a+"):
|
|
451
|
+
def write_csv(data, filepath, mode="a+", malicious_check=False):
|
|
452
|
+
def csv_value_is_valid(value: str) -> bool:
|
|
453
|
+
if not isinstance(value, str):
|
|
454
|
+
return True
|
|
455
|
+
try:
|
|
456
|
+
# -1.00 or +1.00 should be consdiered as digit numbers
|
|
457
|
+
float(value)
|
|
458
|
+
except ValueError:
|
|
459
|
+
# otherwise, they will be considered as formular injections
|
|
460
|
+
return not bool(re.compile(FileCheckConst.CSV_BLACK_LIST).search(value))
|
|
461
|
+
return True
|
|
462
|
+
|
|
463
|
+
if malicious_check:
|
|
464
|
+
for row in data:
|
|
465
|
+
for cell in row:
|
|
466
|
+
if not csv_value_is_valid(cell):
|
|
467
|
+
raise RuntimeError(f"Malicious value [{cell}] is not allowed " \
|
|
468
|
+
f"to be written into the csv: {filepath}.")
|
|
469
|
+
|
|
435
470
|
file_path = os.path.realpath(filepath)
|
|
436
471
|
check_path_before_create(filepath)
|
|
437
472
|
try:
|
|
@@ -444,6 +479,16 @@ def write_csv(data, filepath, mode="a+"):
|
|
|
444
479
|
change_mode(filepath, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
445
480
|
|
|
446
481
|
|
|
482
|
+
def read_csv(filepath):
|
|
483
|
+
check_file_or_directory_path(filepath)
|
|
484
|
+
try:
|
|
485
|
+
csv_data = pd.read_csv(filepath)
|
|
486
|
+
except Exception as e:
|
|
487
|
+
logger.error(f"The csv file failed to load. Please check the path: {filepath}.")
|
|
488
|
+
raise RuntimeError(f"Read csv file {filepath} failed.") from e
|
|
489
|
+
return csv_data
|
|
490
|
+
|
|
491
|
+
|
|
447
492
|
def remove_path(path):
|
|
448
493
|
if not os.path.exists(path):
|
|
449
494
|
return
|