From b225d390fee1e897ce373ef56aa2b862256342f1 Mon Sep 17 00:00:00 2001 From: s30048155 Date: Thu, 25 Jan 2024 15:05:30 +0800 Subject: [PATCH 1/2] bugfix --- .../ptdbg_ascend/debugger/precision_debugger.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py index fa4346873..fdb8b91d7 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py @@ -17,7 +17,7 @@ class PrecisionDebugger: def __new__(cls, *args, **kwargs): if cls._instance is None: - cls._instance = super(PrecisionDebugger, cls).__new__(cls) + cls._instance = super().__new__(cls) cls._instance.first_start = True cls._instance.hook_func = None cls._instance.config = None @@ -32,8 +32,7 @@ class PrecisionDebugger: err_msg = "You must provide hook_name argument to PrecisionDebugger\ when config is not provided." raise Exception(err_msg) - step = step or [] - self.config = DebuggerConfig(dump_path, hook_name, rank, step) + self.config = DebuggerConfig(dump_path, hook_name, rank, step or []) self.configure_hook = self.get_configure_hook(self.config.hook_name) self.configure_hook() DumpUtil.target_iter = self.config.step @@ -154,8 +153,12 @@ class PrecisionDebugger: def iter_tracer(func): def func_wrapper(*args, **kwargs): - PrecisionDebugger.stop() + debugger_instance = PrecisionDebugger._instance + temp_enable_dataloader = debugger_instance.enable_dataloader + debugger_instance.enable_dataloader = False + debugger_instance.stop() result = func(*args, **kwargs) - PrecisionDebugger.incr_iter_num_maybe_exit() + debugger_instance.incr_iter_num_maybe_exit() + debugger_instance.enable_dataloader = temp_enable_dataloader return result return func_wrapper -- Gitee From 94364207f2a6bbedcd12900d61d720ffe63bb114 Mon Sep 17 00:00:00 2001 From: s30048155 Date: Thu, 25 Jan 2024 15:08:36 +0800 Subject: [PATCH 2/2] revert --- .../src/python/ptdbg_ascend/debugger/precision_debugger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py index fdb8b91d7..20edab073 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/debugger/precision_debugger.py @@ -17,7 +17,7 @@ class PrecisionDebugger: def __new__(cls, *args, **kwargs): if cls._instance is None: - cls._instance = super().__new__(cls) + cls._instance = super(PrecisionDebugger, cls).__new__(cls) cls._instance.first_start = True cls._instance.hook_func = None cls._instance.config = None @@ -32,7 +32,8 @@ class PrecisionDebugger: err_msg = "You must provide hook_name argument to PrecisionDebugger\ when config is not provided." raise Exception(err_msg) - self.config = DebuggerConfig(dump_path, hook_name, rank, step or []) + step = step or [] + self.config = DebuggerConfig(dump_path, hook_name, rank, step) self.configure_hook = self.get_configure_hook(self.config.hook_name) self.configure_hook() DumpUtil.target_iter = self.config.step -- Gitee