mindstudio-probe 1.1.1__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/METADATA +3 -2
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/RECORD +196 -141
- msprobe/CMakeLists.txt +5 -0
- msprobe/README.md +14 -19
- msprobe/config.json +1 -0
- msprobe/core/common/const.py +155 -6
- msprobe/core/common/exceptions.py +3 -1
- msprobe/core/common/file_utils.py +33 -7
- msprobe/core/common/inplace_ops.yaml +3 -0
- msprobe/core/common/utils.py +28 -14
- msprobe/core/common_config.py +6 -0
- msprobe/core/compare/acc_compare.py +139 -128
- msprobe/core/compare/check.py +31 -29
- msprobe/core/compare/compare_cli.py +17 -16
- msprobe/core/compare/highlight.py +186 -99
- msprobe/core/compare/layer_mapping/data_scope_parser.py +18 -7
- msprobe/core/compare/layer_mapping/layer_mapping.py +21 -14
- msprobe/core/compare/layer_mapping/postprocess_pass.py +4 -3
- msprobe/core/compare/merge_result/merge_result.py +380 -0
- msprobe/core/compare/merge_result/merge_result_cli.py +31 -0
- msprobe/core/compare/multiprocessing_compute.py +2 -2
- msprobe/core/compare/npy_compare.py +109 -147
- msprobe/core/compare/utils.py +189 -69
- msprobe/core/data_dump/data_collector.py +51 -21
- msprobe/core/data_dump/data_processor/base.py +38 -20
- msprobe/core/data_dump/data_processor/factory.py +5 -3
- msprobe/core/data_dump/data_processor/mindspore_processor.py +154 -20
- msprobe/core/data_dump/data_processor/pytorch_processor.py +118 -58
- msprobe/core/data_dump/json_writer.py +29 -1
- msprobe/core/data_dump/scope.py +19 -18
- msprobe/core/overflow_check/abnormal_scene.py +9 -5
- msprobe/core/overflow_check/checker.py +1 -1
- msprobe/core/overflow_check/utils.py +1 -1
- msprobe/docs/01.installation.md +96 -17
- msprobe/docs/02.config_introduction.md +5 -5
- msprobe/docs/05.data_dump_PyTorch.md +91 -61
- msprobe/docs/06.data_dump_MindSpore.md +57 -19
- msprobe/docs/07.accuracy_checker_PyTorch.md +18 -18
- msprobe/docs/09.accuracy_checker_MindSpore.md +4 -4
- msprobe/docs/10.accuracy_compare_PyTorch.md +99 -41
- msprobe/docs/11.accuracy_compare_MindSpore.md +249 -48
- msprobe/docs/12.overflow_check_PyTorch.md +1 -1
- msprobe/docs/19.monitor.md +120 -27
- msprobe/docs/21.visualization_PyTorch.md +115 -35
- msprobe/docs/22.visualization_MindSpore.md +138 -41
- msprobe/docs/23.generate_operator_PyTorch.md +107 -0
- msprobe/docs/24.code_mapping_Mindspore.md +28 -0
- msprobe/docs/{23.tool_function_introduction.md → 25.tool_function_introduction.md} +1 -0
- msprobe/docs/26.data_dump_PyTorch_baseline.md +37 -0
- msprobe/docs/27.dump_json_instruction.md +521 -0
- msprobe/docs/FAQ.md +26 -2
- msprobe/docs/accuracy_checker_MindSpore/accuracy_checker_MindSpore_baseline.md +14 -0
- msprobe/docs/data_dump_MindSpore/data_dump_MindSpore_baseline.md +22 -0
- msprobe/docs/img/merge_result.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/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_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 +132 -0
- msprobe/docs/visualization/mapping.png +0 -0
- msprobe/docs/visualization/mapping1.png +0 -0
- 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/__init__.py +10 -0
- msprobe/mindspore/api_accuracy_checker/api_accuracy_checker.py +57 -25
- msprobe/mindspore/api_accuracy_checker/cmd_parser.py +2 -1
- msprobe/mindspore/api_accuracy_checker/compute_element.py +5 -7
- msprobe/mindspore/api_accuracy_checker/data_manager.py +37 -0
- msprobe/mindspore/api_accuracy_checker/main.py +1 -0
- msprobe/mindspore/api_accuracy_checker/multi_api_accuracy_checker.py +12 -6
- msprobe/mindspore/api_accuracy_checker/multi_data_manager.py +3 -1
- msprobe/mindspore/code_mapping/bind.py +264 -0
- msprobe/mindspore/code_mapping/cmd_parser.py +40 -0
- msprobe/mindspore/code_mapping/graph.py +49 -0
- msprobe/mindspore/code_mapping/graph_parser.py +226 -0
- msprobe/mindspore/code_mapping/main.py +24 -0
- msprobe/mindspore/code_mapping/processor.py +34 -0
- msprobe/mindspore/common/const.py +3 -1
- msprobe/mindspore/common/utils.py +50 -5
- msprobe/mindspore/compare/distributed_compare.py +0 -2
- msprobe/mindspore/compare/ms_compare.py +105 -63
- msprobe/mindspore/compare/ms_graph_compare.py +14 -5
- msprobe/mindspore/debugger/debugger_config.py +3 -0
- msprobe/mindspore/debugger/precision_debugger.py +81 -12
- msprobe/mindspore/dump/hook_cell/api_registry.py +83 -16
- msprobe/mindspore/dump/hook_cell/hook_cell.py +60 -38
- msprobe/mindspore/dump/hook_cell/primitive_hooks.py +33 -15
- msprobe/mindspore/dump/hook_cell/support_wrap_ops.yaml +11 -1
- msprobe/mindspore/dump/hook_cell/wrap_api.py +92 -1
- msprobe/mindspore/dump/kernel_dump/kernel_config.py +33 -0
- msprobe/mindspore/dump/kernel_graph_dump.py +7 -0
- msprobe/mindspore/free_benchmark/api_pynative_self_check.py +13 -4
- msprobe/mindspore/free_benchmark/perturbation/bit_noise.py +2 -2
- msprobe/mindspore/grad_probe/grad_analyzer.py +24 -12
- msprobe/mindspore/grad_probe/hook.py +13 -4
- msprobe/mindspore/mindtorch/__init__.py +18 -0
- msprobe/mindspore/mindtorch/mindtorch_adaptor.py +255 -0
- msprobe/mindspore/ms_config.py +5 -1
- msprobe/mindspore/overflow_check/kernel_graph_overflow_check.py +7 -0
- msprobe/mindspore/service.py +267 -101
- msprobe/msprobe.py +24 -3
- msprobe/pytorch/__init__.py +7 -6
- msprobe/pytorch/api_accuracy_checker/common/utils.py +31 -16
- msprobe/pytorch/api_accuracy_checker/compare/algorithm.py +41 -8
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_compare.py +100 -267
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_standard.yaml +4 -1
- msprobe/pytorch/api_accuracy_checker/compare/compare.py +69 -68
- msprobe/pytorch/api_accuracy_checker/compare/compare_column.py +54 -0
- msprobe/pytorch/api_accuracy_checker/compare/compare_input.py +51 -0
- msprobe/pytorch/api_accuracy_checker/compare/compare_utils.py +2 -4
- msprobe/pytorch/api_accuracy_checker/generate_op_script/op_generator.py +54 -30
- msprobe/pytorch/api_accuracy_checker/precision_standard/absolute_threshold.py +106 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/accumulative_error_compare.py +107 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/base_standard.py +151 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/benchmark_compare.py +226 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/binary_consistency.py +68 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_config.py +218 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_register.py +104 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/thousandth_standard.py +63 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/ulp_compare.py +200 -0
- msprobe/pytorch/api_accuracy_checker/run_ut/data_generate.py +57 -1
- msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py +2 -1
- msprobe/pytorch/api_accuracy_checker/run_ut/run_overflow_check.py +42 -14
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut.py +64 -19
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut_utils.py +34 -4
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/device_dispatch.py +5 -3
- msprobe/pytorch/bench_functions/npu_fusion_attention.py +42 -10
- msprobe/pytorch/common/parse_json.py +2 -1
- msprobe/pytorch/common/utils.py +45 -2
- msprobe/pytorch/compare/distributed_compare.py +17 -29
- msprobe/pytorch/compare/pt_compare.py +40 -20
- msprobe/pytorch/debugger/debugger_config.py +27 -12
- msprobe/pytorch/debugger/precision_debugger.py +42 -12
- msprobe/pytorch/dump/module_dump/__init__.py +0 -0
- msprobe/pytorch/dump/module_dump/module_dump.py +86 -0
- msprobe/pytorch/{module_processer.py → dump/module_dump/module_processer.py} +80 -6
- msprobe/pytorch/free_benchmark/common/params.py +2 -1
- msprobe/pytorch/free_benchmark/common/utils.py +3 -0
- msprobe/pytorch/free_benchmark/compare/grad_saver.py +0 -2
- msprobe/pytorch/free_benchmark/result_handlers/base_handler.py +31 -47
- msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py +0 -4
- msprobe/pytorch/hook_module/__init__.py +1 -1
- msprobe/pytorch/hook_module/hook_module.py +14 -11
- msprobe/pytorch/hook_module/register_optimizer_hook.py +59 -0
- msprobe/pytorch/hook_module/support_wrap_ops.yaml +34 -0
- msprobe/pytorch/hook_module/wrap_distributed.py +6 -8
- msprobe/pytorch/hook_module/wrap_functional.py +0 -40
- msprobe/pytorch/monitor/anomaly_analyse.py +1 -1
- msprobe/pytorch/monitor/anomaly_detect.py +107 -22
- msprobe/pytorch/monitor/csv2tb.py +166 -0
- msprobe/pytorch/monitor/distributed/wrap_distributed.py +25 -14
- msprobe/pytorch/monitor/features.py +3 -3
- msprobe/pytorch/monitor/module_hook.py +483 -277
- msprobe/pytorch/monitor/module_metric.py +27 -48
- msprobe/pytorch/monitor/module_spec_verifier.py +3 -1
- msprobe/pytorch/monitor/optimizer_collect.py +52 -14
- msprobe/pytorch/monitor/unittest/test_monitor.py +24 -9
- msprobe/pytorch/monitor/utils.py +77 -6
- msprobe/pytorch/online_dispatch/dispatch.py +8 -2
- msprobe/pytorch/parse_tool/lib/compare.py +10 -10
- msprobe/pytorch/parse_tool/lib/config.py +5 -7
- msprobe/pytorch/parse_tool/lib/file_desc.py +15 -1
- msprobe/pytorch/parse_tool/lib/interactive_cli.py +10 -10
- msprobe/pytorch/parse_tool/lib/parse_exception.py +7 -7
- msprobe/pytorch/parse_tool/lib/parse_tool.py +11 -10
- msprobe/pytorch/parse_tool/lib/utils.py +18 -19
- msprobe/pytorch/parse_tool/lib/visualization.py +9 -10
- msprobe/pytorch/service.py +176 -106
- msprobe/visualization/builder/graph_builder.py +62 -5
- msprobe/visualization/builder/msprobe_adapter.py +24 -2
- msprobe/visualization/compare/graph_comparator.py +64 -14
- msprobe/visualization/compare/mode_adapter.py +1 -15
- msprobe/visualization/graph/base_node.py +12 -17
- msprobe/visualization/graph/distributed_analyzer.py +318 -0
- msprobe/visualization/graph/graph.py +9 -0
- msprobe/visualization/graph_service.py +97 -23
- msprobe/visualization/utils.py +14 -29
- msprobe/pytorch/functional/module_dump.py +0 -84
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/LICENSE +0 -0
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/WHEEL +0 -0
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/entry_points.txt +0 -0
- {mindstudio_probe-1.1.1.dist-info → mindstudio_probe-1.2.1.dist-info}/top_level.txt +0 -0
- /msprobe/docs/{data_dump_Mindspore → data_dump_MindSpore}/dynamic_graph_quick_start_example.md +0 -0
- /msprobe/{pytorch/functional → mindspore/code_mapping}/__init__.py +0 -0
msprobe/core/data_dump/scope.py
CHANGED
|
@@ -45,7 +45,7 @@ class ScopeFactory:
|
|
|
45
45
|
|
|
46
46
|
if self.level == Const.LEVEL_MIX:
|
|
47
47
|
return mix_range_scope
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
if not self.scope:
|
|
50
50
|
return api_range_scope
|
|
51
51
|
if api_range_scope.is_valid and module_range_scope.is_valid:
|
|
@@ -73,21 +73,21 @@ class BaseScope(ABC):
|
|
|
73
73
|
def rectify_args(scope, api_list):
|
|
74
74
|
if not isinstance(api_list, list):
|
|
75
75
|
raise ScopeException(ScopeException.InvalidApiStr,
|
|
76
|
-
|
|
76
|
+
f"api_list参数须配置为列表,实际类型为{type(api_list)}.")
|
|
77
77
|
for api in api_list:
|
|
78
78
|
if not isinstance(api, str):
|
|
79
79
|
raise ScopeException(ScopeException.InvalidApiStr,
|
|
80
|
-
|
|
80
|
+
f"api_list中的元素须配置为字符串,实际类型为{type(api)}.")
|
|
81
81
|
if isinstance(scope, str):
|
|
82
82
|
scope = [scope]
|
|
83
83
|
return scope, api_list
|
|
84
84
|
if not isinstance(scope, list):
|
|
85
85
|
raise ScopeException(ScopeException.InvalidScope,
|
|
86
|
-
|
|
86
|
+
f"scope参数须配置为字符串或列表,实际类型为{type(scope)}.")
|
|
87
87
|
for s in scope:
|
|
88
88
|
if not isinstance(s, str):
|
|
89
89
|
raise ScopeException(ScopeException.InvalidScope,
|
|
90
|
-
|
|
90
|
+
f"scope列表元素要求类型为字符串,实际类型为{type(s)}.")
|
|
91
91
|
return scope, api_list
|
|
92
92
|
|
|
93
93
|
@abstractmethod
|
|
@@ -108,7 +108,7 @@ class ListScope(BaseScope):
|
|
|
108
108
|
def rectify_args(scope, api_list):
|
|
109
109
|
if scope and api_list:
|
|
110
110
|
raise ScopeException(ScopeException.ArgConflict,
|
|
111
|
-
|
|
111
|
+
f"scope和api_list不可以同时配置,实际配置为scope={scope}, api_list={api_list}.")
|
|
112
112
|
return super(ListScope, ListScope).rectify_args(scope, api_list)
|
|
113
113
|
|
|
114
114
|
def check(self, name):
|
|
@@ -123,6 +123,7 @@ class RangeScope(BaseScope, ABC):
|
|
|
123
123
|
super().__init__(*args)
|
|
124
124
|
self.in_scope = False
|
|
125
125
|
self.in_list = False
|
|
126
|
+
self.start_name_set = set()
|
|
126
127
|
self.is_valid = self.check_scope_is_valid()
|
|
127
128
|
|
|
128
129
|
def check_name_pattern(self, name):
|
|
@@ -133,23 +134,23 @@ class RangeScope(BaseScope, ABC):
|
|
|
133
134
|
if self.level == Const.LEVEL_L1:
|
|
134
135
|
if not re.match(api_pattern, name):
|
|
135
136
|
raise ScopeException(ScopeException.InvalidScope,
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
f"scope参数格式错误,要求格式为api完整命名,实际为{name}.")
|
|
138
|
+
|
|
138
139
|
if self.level == Const.LEVEL_L0:
|
|
139
140
|
if not re.match(module_pattern, name):
|
|
140
141
|
raise ScopeException(ScopeException.InvalidScope,
|
|
141
|
-
|
|
142
|
+
f"scope参数格式错误,要求格式为模块完整命名,实际为{name}.")
|
|
142
143
|
|
|
143
144
|
if self.level == Const.LEVEL_MIX:
|
|
144
145
|
if not re.match(api_pattern, name) and not re.match(module_pattern, name):
|
|
145
146
|
raise ScopeException(ScopeException.InvalidScope,
|
|
146
|
-
|
|
147
|
+
f"scope参数格式错误,要求格式为api或模块完整命名,实际为{name}.")
|
|
147
148
|
|
|
148
149
|
def rectify_args(self, scope, api_list):
|
|
149
150
|
scope, api_list = super(RangeScope, RangeScope).rectify_args(scope, api_list)
|
|
150
151
|
if scope and len(scope) != 2:
|
|
151
152
|
raise ScopeException(ScopeException.InvalidScope,
|
|
152
|
-
|
|
153
|
+
f"scope参数指定区间断点,须传入长度为2的列表,实际长度为{len(scope)}.")
|
|
153
154
|
for name in scope:
|
|
154
155
|
self.check_name_pattern(name)
|
|
155
156
|
return scope, api_list
|
|
@@ -229,30 +230,31 @@ class ModuleRangeScope(RangeScope):
|
|
|
229
230
|
class MixRangeScope(RangeScope):
|
|
230
231
|
def check_scope_is_valid(self):
|
|
231
232
|
return True if self.scope else False
|
|
232
|
-
|
|
233
|
+
|
|
233
234
|
def begin_module(self, module_name):
|
|
234
235
|
if self.scope and module_name == self.scope[0]:
|
|
235
236
|
self.in_scope = True
|
|
236
237
|
for name in self.api_list:
|
|
237
238
|
if name in module_name:
|
|
238
239
|
self.in_list = True
|
|
240
|
+
self.start_name_set.add(module_name) # 记录每一个开启in_list的module_name
|
|
239
241
|
|
|
240
242
|
def end_module(self, module_name):
|
|
241
243
|
if self.scope and module_name == self.scope[1]:
|
|
242
244
|
self.in_scope = False
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
self.start_name_set.discard(module_name) # 从集合中删除每一个module_name
|
|
246
|
+
if not self.start_name_set: # 如果集合为空,说明当前module_name是最后一个开启in_list的module_name
|
|
247
|
+
self.in_list = False # 关闭in_list
|
|
246
248
|
|
|
247
249
|
def check_api_list(self, api_name):
|
|
248
250
|
if not self.api_list:
|
|
249
251
|
return True
|
|
250
|
-
|
|
252
|
+
|
|
251
253
|
for name in self.api_list:
|
|
252
254
|
if name in api_name:
|
|
253
255
|
return True
|
|
254
256
|
return False
|
|
255
|
-
|
|
257
|
+
|
|
256
258
|
def check(self, name):
|
|
257
259
|
"""
|
|
258
260
|
dump时调用的接口,根据scope和api_list判断是否需要dump
|
|
@@ -270,4 +272,3 @@ class MixRangeScope(RangeScope):
|
|
|
270
272
|
if self.scope and name == self.scope[1]:
|
|
271
273
|
self.in_scope = False
|
|
272
274
|
return result
|
|
273
|
-
|
|
@@ -37,7 +37,11 @@ class AnomalyScene:
|
|
|
37
37
|
@staticmethod
|
|
38
38
|
def _has_anomaly(data: Union[Dict, Any]) -> bool:
|
|
39
39
|
"""检查张量是否包含异常值"""
|
|
40
|
-
|
|
40
|
+
if isinstance(data, dict):
|
|
41
|
+
return has_nan_inf(data)
|
|
42
|
+
elif isinstance(data, list):
|
|
43
|
+
return any(AnomalyScene._has_anomaly(x) for x in data)
|
|
44
|
+
return False
|
|
41
45
|
|
|
42
46
|
def get_details(self) -> Dict:
|
|
43
47
|
"""获取异常详情"""
|
|
@@ -70,14 +74,14 @@ class InputOutputAnomalyScene(AnomalyScene):
|
|
|
70
74
|
def has_input_anomaly(self) -> bool:
|
|
71
75
|
"""检查输入是否有异常(包括args和kwargs)"""
|
|
72
76
|
# args
|
|
73
|
-
args_anomaly = any(self._has_anomaly(x) for x in self.api_data.input_args
|
|
77
|
+
args_anomaly = any(self._has_anomaly(x) for x in self.api_data.input_args)
|
|
74
78
|
# kwargs
|
|
75
|
-
kwargs_anomaly = any(self._has_anomaly(x) for x in self.api_data.input_kwargs.values()
|
|
79
|
+
kwargs_anomaly = any(self._has_anomaly(x) for x in self.api_data.input_kwargs.values())
|
|
76
80
|
return args_anomaly or kwargs_anomaly
|
|
77
81
|
|
|
78
82
|
def has_output_anomaly(self) -> bool:
|
|
79
83
|
"""检查输出是否有异常"""
|
|
80
|
-
return any(self._has_anomaly(x) for x in self.api_data.output_data
|
|
84
|
+
return any(self._has_anomaly(x) for x in self.api_data.output_data)
|
|
81
85
|
|
|
82
86
|
def matches(self) -> bool:
|
|
83
87
|
"""判断是否匹配该场景"""
|
|
@@ -121,7 +125,7 @@ class NumericalMutationScene(AnomalyScene):
|
|
|
121
125
|
"""
|
|
122
126
|
检查数值突变,统计输入args、kwargs中norm值,同时统计输出的norm最大值,计算差异,大于 threshold 则认为是异常情况
|
|
123
127
|
"""
|
|
124
|
-
def __init__(self, api_info: APIInfo, threshold: float =
|
|
128
|
+
def __init__(self, api_info: APIInfo, threshold: float = 100.0):
|
|
125
129
|
super().__init__(api_info)
|
|
126
130
|
self.threshold = threshold
|
|
127
131
|
|
|
@@ -62,7 +62,7 @@ class AnomalyDetector:
|
|
|
62
62
|
"""从原始数据创建APIInfo实例"""
|
|
63
63
|
return APIInfo(
|
|
64
64
|
api_name=api_name,
|
|
65
|
-
input_args=data.get(Const.INPUT_ARGS, []),
|
|
65
|
+
input_args=data.get(Const.INPUT_ARGS, data.get(Const.INPUT, [])),
|
|
66
66
|
input_kwargs=data.get(Const.INPUT_KWARGS, {}),
|
|
67
67
|
output_data=data.get(Const.OUTPUT, [])
|
|
68
68
|
)
|
msprobe/docs/01.installation.md
CHANGED
|
@@ -16,6 +16,8 @@ pip install mindstudio-probe
|
|
|
16
16
|
|
|
17
17
|
|版本|发布日期|支持 PyTorch 版本|支持 MindSpore 版本|下载链接|校验码|
|
|
18
18
|
|:--:|:--:|:--:|:--:|:--:|:--:|
|
|
19
|
+
|1.2.0|2025.1.13|1.11/2.0/2.1/2.2|2.4.0|[mindstudio_probe-1.2.0-py3-none-any.whl](https://ptdbg.obs.myhuaweicloud.com/msprobe/1.2/mindstudio_probe-1.2.0-py3-none-any.whl)|1e3aeea1706112f6ee52fd1165037936bb209138f0b9ec42ea21e2c1c8942cdc|
|
|
20
|
+
|1.1.1|2024.12.09|1.11/2.0/2.1/2.2|2.4.0|[mindstudio_probe-1.1.1-py3-none-any.whl](https://ptdbg.obs.myhuaweicloud.com/msprobe/1.1/mindstudio_probe-1.1.1-py3-none-any.whl)|577b597555dc155b76ba1a62d575c3546004644e140a456c3ba0824d46283735|
|
|
19
21
|
|1.1.0|2024.10.14|1.11/2.0/2.1/2.2|2.4.0|[mindstudio_probe-1.1.0-py3-none-any.whl](https://ptdbg.obs.myhuaweicloud.com/msprobe/1.1/mindstudio_probe-1.1.0-py3-none-any.whl)|83a5a9b7c65a357639f8c9636d88c693b4cf0eb590d4f8f5cb56395ba69b1f6d|
|
|
20
22
|
|1.0.4|2024.09.09|1.11/2.0/2.1/2.2|2.4.0|[mindstudio_probe-1.0.4-py3-none-any.whl](https://ptdbg.obs.myhuaweicloud.com/msprobe/1.0/mindstudio_probe-1.0.4-py3-none-any.whl)|4e1909566a71a855b356597750c20ee43d964a22b2c2b02ac08312a5def75fd6|
|
|
21
23
|
| 1.0.3 | 2024.08.23 | 1.11/2.0/2.1/2.2 | 2.4.0 | [mindstudio_probe-1.0.3-py3-none-any.whl](https://ptdbg.obs.myhuaweicloud.com/msprobe/1.0/mindstudio_probe-1.0.3-py3-none-any.whl) | 7060cc141a5b98ef770cd9220995d299393f32a61938261e632c7e8b5160bef2 |
|
|
@@ -41,27 +43,104 @@ cd mstt/debug/accuracy_tools
|
|
|
41
43
|
|
|
42
44
|
pip install setuptools wheel
|
|
43
45
|
|
|
44
|
-
python setup.py bdist_wheel
|
|
46
|
+
python setup.py bdist_wheel [--include-mod=[adump]]
|
|
45
47
|
cd ./dist
|
|
46
48
|
pip install ./mindstudio_probe*.whl
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
|参数|说明|是否必选|
|
|
52
|
+
|--|--|:--:|
|
|
53
|
+
|--include-mod|指定可选模块,可取值`adump`,表示在编whl包时加入adump模块。默认未配置该参数,表示编基础包。<br>• adump模块用于MindSpore静态图场景L2级别的dump。<br>• 仅MindSpore 2.5.0及以上版本支持adump模块。<br>• 若使用源码安装,编译环境需支持GCC 7或以上版本,和CMAKE 3.14或以上版本。<br>• 生成的whl包仅限编译时使用的python版本和处理器架构可用。|否|
|
|
54
|
+
|
|
55
|
+
# 特性变更说明
|
|
56
|
+
|
|
57
|
+
## 1.1.1
|
|
58
|
+
|
|
59
|
+
【数据采集】
|
|
60
|
+
|
|
61
|
+
- dump 支持 processgroup、namedtuple、slice 等数据类型
|
|
62
|
+
- MindSpore 动态图 dump 能力增强,支持 mix 模式 dump、控制 dropout 失效、支持控制区间正反向数据 dump
|
|
63
|
+
|
|
64
|
+
【精度预检】
|
|
65
|
+
|
|
66
|
+
- PyTorch 场景新增单算子 API 自动生成脚本
|
|
67
|
+
- MindSpore 动态图场景新增支持 multi_run_ut 多线程预检
|
|
68
|
+
- MindSpore 场景新增支持断点续检
|
|
69
|
+
|
|
70
|
+
【精度比对】
|
|
71
|
+
|
|
72
|
+
- 新增 MindSpore 跨框架比对能力,支持 MindSpore 与 PyTorch 跨框架比对
|
|
73
|
+
- 支持异常比对结果数据自动颜色标注
|
|
74
|
+
|
|
75
|
+
【无标杆比对】
|
|
76
|
+
|
|
77
|
+
- Mindspore 动态图场景支持反向过程的无标杆比对
|
|
78
|
+
|
|
79
|
+
【训练状态监控】
|
|
80
|
+
|
|
81
|
+
- 新增支持通信聚合前梯度信息监控
|
|
82
|
+
|
|
83
|
+
【分级可视化构图比对】
|
|
84
|
+
|
|
85
|
+
- 新增分级可视化构图比对工具,支持单数据构图、溢出检测、双数据比对构图、同时支持传入映射文件,支持跨框架或同框架比对
|
|
86
|
+
|
|
87
|
+
## 1.1.0
|
|
88
|
+
|
|
89
|
+
【总体】
|
|
90
|
+
|
|
91
|
+
- 训练精度一体化工具 atat 统一更名为 msprobe
|
|
92
|
+
- msprobe 支持日志分级功能
|
|
93
|
+
|
|
94
|
+
【数据采集】
|
|
95
|
+
|
|
96
|
+
- 增加 L1 dump 接口,支持在指定区间内进行正反向 dump 功能
|
|
97
|
+
- 新增 MindSpore 函数式接口的通信 API dump 功能
|
|
98
|
+
|
|
99
|
+
【精度预检】
|
|
100
|
+
|
|
101
|
+
- 支持配置 blacklist 黑名单字段
|
|
102
|
+
- 补充了支持的融合算子列表
|
|
103
|
+
|
|
104
|
+
【精度比对】
|
|
105
|
+
|
|
106
|
+
- 支持 data mapping 和 layer mapping 的比对功能。
|
|
107
|
+
|
|
108
|
+
【梯度工具】
|
|
109
|
+
|
|
110
|
+
- 增加了梯度工具中关于 JIT 限制的说明
|
|
111
|
+
|
|
112
|
+
## 1.0.4
|
|
113
|
+
|
|
114
|
+
【数据采集】
|
|
115
|
+
|
|
116
|
+
- 支持在 config.json 中传入 step 范围配置
|
|
117
|
+
- 优化了 MindSpore 场景下的 step 机制,step 结束后训练继续运行
|
|
118
|
+
|
|
119
|
+
【精度预检】
|
|
120
|
+
|
|
121
|
+
- 在 PyTorch 场景下,支持部分 NPU 融合算子精度预检
|
|
122
|
+
|
|
123
|
+
【精度比对】
|
|
124
|
+
|
|
125
|
+
- 解决了在 MindSpore 场景下需要安装 PyTorch 的问题
|
|
126
|
+
|
|
127
|
+
【无标杆比对】
|
|
128
|
+
|
|
129
|
+
- 补充了 PyTorch 场景的性能基线报告
|
|
130
|
+
- 支持 MindSpore 场景下的 change_value 扰动模式
|
|
131
|
+
|
|
132
|
+
## 1.0.3
|
|
133
|
+
|
|
134
|
+
【精度预检】
|
|
135
|
+
|
|
136
|
+
- 落盘数据缩减
|
|
137
|
+
- 支持随机生成模式和真实数据模式
|
|
138
|
+
- 单 API 测试,排除整网中的累计误差问题
|
|
139
|
+
|
|
140
|
+
【梯度检测】
|
|
141
|
+
|
|
142
|
+
- 使用便捷,无需在训练流程里插入代码
|
|
143
|
+
- 可以精准定位问题出现的 step
|
|
65
144
|
|
|
66
145
|
# 查看 msprobe 工具信息
|
|
67
146
|
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"scope": ["Module.conv1.Conv2d.forward.0", "Module.fc2.Linear.forward.0"],
|
|
38
38
|
或 "scope": ["Cell.conv1.Conv2d.forward.0", "Cell.fc2.Dense.backward.0"], 或"scope": ["Tensor.add.0.forward", "Functional.square.2.forward"]。与 level 参数取值相关,level 为 L0 级别时,可配置模块名;level 为 L1 级别时,可配置 API 名, level为 mix 级别时,可配置为模块名或API名。</td><td>否</td></tr>
|
|
39
39
|
<tr><td rowspan="4">list</td><td>自定义采集的算子列表,list[str] 类型,默认未配置(scope 也未配置时表示 dump 所有 API 的数据),包含以下配置方法:</td><td rowspan="4">否</td></tr>
|
|
40
|
-
<tr><td>PyTorch 和 MindSpore 动态图场景配置具体的 API 全称,dump 该 API 数据。在 PyTorch 场景,如果 level 配置成 L2,该配置为必填项。<br/><b>配置示例</b>:"list": ["Tensor.permute.1.forward", "Tensor.transpose.2.forward", "Torch.relu.3.backward"]。<br/> PyTorch 和 MindSpore 动态图场景在level为 mix 级别时可以配置模块名称,dump该模块展开数据 (dump
|
|
40
|
+
<tr><td>PyTorch 和 MindSpore 动态图场景配置具体的 API 全称,dump 该 API 数据。在 PyTorch 场景,如果 level 配置成 L2,该配置为必填项。<br/><b>配置示例</b>:"list": ["Tensor.permute.1.forward", "Tensor.transpose.2.forward", "Torch.relu.3.backward"]。<br/> PyTorch 和 MindSpore 动态图场景在level为 mix 级别时可以配置模块名称,dump该模块展开数据 (dump该模块从执行开始到执行结束期间的所有数据)。
|
|
41
41
|
<br/><b>配置示例</b>:"list": ["Module.module.language_model.encoder.layers.0.mlp.ParallelMlp.forward.0"], 或 "list": ["Cell.network_with_loss.language_model.encoder.layers.0.mlp.ParallelMlp.forward.0"]</td></tr>
|
|
42
|
-
<tr><td>PyTorch 和 MindSpore 动态图场景指定某一类 API,dump 某一类的 API 级别输入输出数据。<br/><b>配置示例</b>:"list": ["relu"]。 <br/> PyTorch 和 MindSpore 动态图场景在level为 mix 级别时, 会dump名称中包含list中配置的字符串的API数据,还会将名称中包含list中配置的字符串的模块进行展开dump (dump
|
|
42
|
+
<tr><td>PyTorch 和 MindSpore 动态图场景指定某一类 API,dump 某一类的 API 级别输入输出数据。<br/><b>配置示例</b>:"list": ["relu"]。 <br/> PyTorch 和 MindSpore 动态图场景在level为 mix 级别时, 会dump名称中包含list中配置的字符串的API数据,还会将名称中包含list中配置的字符串的模块进行展开dump (dump该模块从执行开始到执行结束期间的所有数据)。</td></tr>
|
|
43
43
|
<tr><td>MindSpore 静态图场景配置 kernel_name,可以是算子的名称列表,也可以指定算子类型("level": "L2"时不支持),还可以配置算子名称的正则表达式(当字符串符合“name-regex(xxx)”格式时,后台则会将其作为正则表达式。<br/><b>配置示例</b>:list: ["name-regex(Default/.+)"]<br/>可匹配算子名称以“Default/”开头的所有算子。</td></tr>
|
|
44
44
|
<tr><td rowspan="3">data_mode</td><td>dump 数据过滤,str 类型。</td><td rowspan="3">否</td></tr>
|
|
45
45
|
<tr><td>PyTorch 与 MindSpore 动态图场景:支持"all"、"forward"、"backward"、"input"和"output",除"all"外,其余参数可以自由组合。默认为["all"],即保存所有 dump 的数据。<br/> <b>配置示例</b>:"data_mode": ["backward"] (仅保存反向数据)或 "data_mode": ["forward", "input"](仅保存前向的输入数据)。</td></tr>
|
|
46
46
|
<tr><td>MindSpore 静态图场景:仅支持"all"、"input"和"output"参数,且各参数只能单独配置,不支持自由组合。<br/><b>配置示例</b>:"data_mode": ["all"]。</td></tr>
|
|
47
|
-
<tr><td>summary_mode</td><td>控制 dump 文件输出的模式,str 类型,仅 PyTorch 与 MindSpore 动态图场景支持,可选参数:<br/> md5:dump 输出包含 CRC-32 值以及 API 统计信息的 dump.json 文件,用于验证数据的完整性;<br/> statistics:dump 仅输出包含 API 统计信息的 dump.json 文件,默认值。<br/><b>配置示例</b>:"summary_mode": "md5"。</td><td>否</td></tr>
|
|
47
|
+
<tr><td rowspan="2">summary_mode</td><td>控制 dump 文件输出的模式,str 类型,仅 PyTorch 与 MindSpore 动态图场景支持,可选参数:<br/> md5:dump 输出包含 CRC-32 值以及 API 统计信息的 dump.json 文件,用于验证数据的完整性;<br/> statistics:dump 仅输出包含 API 统计信息的 dump.json 文件,默认值。<br/><b>配置示例</b>:"summary_mode": "md5"。</td><td rowspan="2">否</td><tr><td>MindSpore静态图jit_level=O2场景L2级dump,支持上述配置的同时额外支持配置统计项列表,可选统计项为max、min、mean、l2norm,可从中任意选取组合搭配。其中mean、l2norm的结果为float数据格式。<br/><b>配置示例</b>:"summary_mode": ["max", "min"]。</td></tr></tr>
|
|
48
48
|
</table>
|
|
49
49
|
|
|
50
50
|
**说明**:"summary_mode"配置为"md5"时,所使用的校验算法为CRC-32算法。
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
| scope | 与[ 1.2 task 配置为 statistics ](#12-task-配置为-statistics)中的解释相同。 | 否 |
|
|
57
57
|
| list | 与[ 1.2 task 配置为 statistics ](#12-task-配置为-statistics)中的解释相同。 | 否 |
|
|
58
58
|
| data_mode | 与[ 1.2 task 配置为 statistics ](#12-task-配置为-statistics)中的解释相同 | 否 |
|
|
59
|
-
| file_format | tensor 数据的保存格式,str 类型,仅支持 MindSpore 静态图场景的 L2
|
|
59
|
+
| file_format | tensor 数据的保存格式,str 类型,仅支持 MindSpore 静态图场景的 L2 级别配置该字段,其他场景不生效。可选参数:<br/> "bin":dump 的 tensor 文件为二进制格式;<br/>"npy":dump 的 tensor 文件后缀为 .npy,默认值。 | 否 |
|
|
60
60
|
| online_run_ut<sup>a</sup> | 在线预检模式开关,bool 类型,可选参数 true(开启)、false(关闭),默认未配置,表示关闭。配置为 true 表示开启在线预检。| 否 |
|
|
61
61
|
| nfs_path<sup>a</sup> | 在线预检模式共享存储目录路径,str 类型,用于 GPU 设备和 NPU 设备间进行通信。仅在 online_run_ut 字段配置为 true 时生效,配置该参数后 host 和 port 不生效。 | 否 |
|
|
62
62
|
| host<sup>a</sup> | 在线预检模式局域网场景信息接收端 IP,str 类型,用于 GPU 设备和 NPU 设备间进行通信,NPU 侧须配置为 GPU 侧的局域网 IP 地址。仅在 online_run_ut 字段配置为 true 时生效,局域网场景时,不能配置 nfs_path 参数,否则局域网场景不生效。 | 否 |
|
|
@@ -149,7 +149,7 @@ PyTorch 与 MindSpore 动态图场景下,"level"须为"L0"或"L1";MindSpore
|
|
|
149
149
|
| param_list | 权重名称列表,表示需要监控的权重。列表为空就表示监控所有权重。默认为空。 | List[str] | 否 |
|
|
150
150
|
| bounds | 区间列表,用来划分区间以统计数值的分布。需要保证由数据小到大排列,并且列表中的元素需要在int64取值范围内。可以使用默认值[-1, 0, 1]。 | List[float, int] | 否 |
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
**不同级别的level的导出数据**
|
|
154
154
|
|
|
155
155
|
|