From 8fa58151714bb0c1e5f54b30e5a106a8c382225b Mon Sep 17 00:00:00 2001 From: i-robot Date: Fri, 8 Aug 2025 07:39:36 +0000 Subject: [PATCH] =?UTF-8?q?!5068=20=E3=80=90bugfix=E3=80=91=E3=80=90?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E3=80=91=E6=AF=94=E5=AF=B9=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E5=8A=A0=E5=9B=BA=E3=80=81=E9=A2=84=E6=A3=80=E6=9B=B4=E5=85=A8?= =?UTF-8?q?=E9=9D=A2=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7=E5=A4=84=E7=90=86?= =?UTF-8?q?=20Merge=20pull=20request=20!5068=20from=20yinglinwei/master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/compare/layer_mapping/layer_mapping.py | 12 ++++++++---- .../api_accuracy_checker/run_ut/multi_run_ut.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/debug/accuracy_tools/msprobe/core/compare/layer_mapping/layer_mapping.py b/debug/accuracy_tools/msprobe/core/compare/layer_mapping/layer_mapping.py index 4845adb04..3ea4c3c58 100644 --- a/debug/accuracy_tools/msprobe/core/compare/layer_mapping/layer_mapping.py +++ b/debug/accuracy_tools/msprobe/core/compare/layer_mapping/layer_mapping.py @@ -18,12 +18,12 @@ from collections import defaultdict from msprobe.core.common.const import CompareConst, Const from msprobe.core.common.file_utils import load_json, load_yaml, save_yaml -from msprobe.core.common.utils import (add_time_with_yaml, - detect_framework_by_dump_json, - get_stack_construct_by_dump_json_path) +from msprobe.core.common.utils import add_time_with_yaml, detect_framework_by_dump_json, \ + get_stack_construct_by_dump_json_path, CompareException from msprobe.core.compare.layer_mapping.data_scope_parser import get_dump_data_items from msprobe.core.compare.utils import read_op, reorder_op_name_list from msprobe.core.common.decorator import recursion_depth_decorator +from msprobe.core.common.log import logger class LayerTrie: @@ -63,7 +63,11 @@ class LayerTrie: node = node.children[name] if index >= len(node.data_items[state]): return default_value - return node.data_items[state][index] + if node.data_items[state]: + return node.data_items[state][index] + else: + logger.error(f"node.data_items of state:{state} is empty, please check.") + raise CompareException(CompareException.INDEX_OUT_OF_BOUNDS_ERROR) def save_to_yaml(self, output_path): result = {f"{self.type_name} @ {self}": self.convert_to_dict(self)} diff --git a/debug/accuracy_tools/msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py b/debug/accuracy_tools/msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py index 15e18fe85..8362b551a 100644 --- a/debug/accuracy_tools/msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py +++ b/debug/accuracy_tools/msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py @@ -84,8 +84,8 @@ def split_json_file(input_file, num_splits, filter_api): for file in split_files: try: remove_path(file) - except FileNotFoundError: - logger.error(f"File not found and could not be deleted: {file}") + except Exception: + logger.error(f"File not found or could not be deleted: {file}") msg = 'ERROR: Split json file failed, please check the input file and try again.' raise CompareException(CompareException.PARSE_FILE_ERROR, msg) from e return split_files, total_items -- Gitee