From d32dbcfc8737e3c356d9572c8d6754f561d7044c Mon Sep 17 00:00:00 2001 From: gitee Date: Thu, 12 Oct 2023 16:24:19 +0800 Subject: [PATCH 1/2] fix --- .../src/python/ptdbg_ascend/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/__init__.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/__init__.py index 1fedc0b746..52fa7d5e74 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/__init__.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/__init__.py @@ -16,6 +16,9 @@ # ============================================================================== """ + +import torch + from .compare.acc_compare import compare, parse from .compare.distributed_compare import compare_distributed from .dump.dump import acc_cmp_dump @@ -23,12 +26,22 @@ from .overflow_check.overflow_check import overflow_check from .overflow_check.utils import set_overflow_check_switch from .dump.utils import set_dump_path, set_dump_switch, set_backward_input from .hook_module.register_hook import register_hook -from .common.utils import seed_all +from .common.utils import seed_all, torch_without_guard_version, print_info_log from .common.version import __version__ from .debugger.debugger_config import DebuggerConfig from .debugger.precision_debugger import PrecisionDebugger seed_all() +def jit_script(obj, optimize=None, _frames_up=0, _rcb=None, example_input=None): + print_info_log("The torch_npu earlier than 2.1 does not support torch.jit.script. " + "Therefore, to ensure that the dump data of the GPU and NPU is consistent, " + "when the torch version is earlier than 2.1, torch.jit.script will be disabled " + "on both the GPU and NPU.") + return obj + +if not torch_without_guard_version: + torch.jit.script = jit_script + __all__ = ["register_hook", "set_dump_path", "set_dump_switch", "set_overflow_check_switch", "seed_all", "acc_cmp_dump", "overflow_check", "compare", "parse", "compare_distributed", "set_backward_input", "PrecisionDebugger", "DebuggerConfig"] -- Gitee From 5189c627f61b1687f914692de04866e18b518867 Mon Sep 17 00:00:00 2001 From: gitee Date: Thu, 12 Oct 2023 16:28:04 +0800 Subject: [PATCH 2/2] fix --- .../ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py index 8c20b15e58..41e63cb0cd 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/dump/dump.py @@ -147,7 +147,7 @@ def dump_data(dump_file_name, dump_step, prefix, data_info): def dump_stack_info(name_template, dump_file): stack_str = [] try: - for (_, path, line, func, code, _) in inspect.stack()[3:]: + for (_, path, line, func, code, _) in inspect.stack()[4:]: if code: stack_line = [path, str(line), func, code[0].strip() if code else code] else: -- Gitee