From 5ccb3f70674c9e048b0ba2ec6051c95d2f9f1d2b Mon Sep 17 00:00:00 2001 From: gitee Date: Wed, 17 Apr 2024 15:36:22 +0800 Subject: [PATCH 1/2] fix --- debug/accuracy_tools/api_accuracy_checker/common/utils.py | 2 +- debug/accuracy_tools/ptdbg_ascend/configure.py | 8 +++++--- .../ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py | 4 +++- .../ptdbg_ascend/test/ut/test_common_util.py | 5 ++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/debug/accuracy_tools/api_accuracy_checker/common/utils.py b/debug/accuracy_tools/api_accuracy_checker/common/utils.py index eee58ef7ae..f6f4d26f59 100644 --- a/debug/accuracy_tools/api_accuracy_checker/common/utils.py +++ b/debug/accuracy_tools/api_accuracy_checker/common/utils.py @@ -39,7 +39,7 @@ else: from ptdbg_ascend.src.python.ptdbg_ascend.common.file_check_util import FileCheckConst, FileChecker, FileOpen from ptdbg_ascend.src.python.ptdbg_ascend.common import file_check_util -torch_without_guard_version_list = ['2.1'] +torch_without_guard_version_list = ['2.1', '2.2'] for version in torch_without_guard_version_list: if torch.__version__.startswith(version): torch_without_guard_version = True diff --git a/debug/accuracy_tools/ptdbg_ascend/configure.py b/debug/accuracy_tools/ptdbg_ascend/configure.py index 7a3f87c08e..ed7f3fe8c5 100644 --- a/debug/accuracy_tools/ptdbg_ascend/configure.py +++ b/debug/accuracy_tools/ptdbg_ascend/configure.py @@ -19,6 +19,7 @@ _PYTORCH_VERSION_1_8 = "1.8" _PYTORCH_VERSION_1_11 = "1.11" _PYTORCH_VERSION_2_0 = "2.0" _PYTORCH_VERSION_2_1 = "2.1" +_PYTORCH_VERSION_2_2 = "2.2" _PYTHON_BIN_PATH_ENV = "ADAPTER_TARGET_PYTHON_PATH" _ASCEND_INSTALLED_PATH_ENV = "ASCEND_INSTALLED_PATH" @@ -50,7 +51,7 @@ def setup_python(env_path): """Get python install path.""" default_python_bin_path = sys.executable ask_python_bin_path = ('Please specify the location of python with valid ' - 'pytorch 1.11/2.0/2.1 site-packages installed. [Default ' + 'pytorch 1.11/2.0/2.1/2.2 site-packages installed. [Default ' 'is %s]\n(You can make this quiet by set env ' '[ADAPTER_TARGET_PYTHON_PATH]): ') % default_python_bin_path custom_python_bin_path = env_path @@ -80,9 +81,10 @@ def setup_python(env_path): if (not compile_args[0].startswith(_PYTORCH_VERSION_1_8)) and \ (not compile_args[0].startswith(_PYTORCH_VERSION_1_11)) and \ (not compile_args[0].startswith(_PYTORCH_VERSION_2_0)) and \ - (not compile_args[0].startswith(_PYTORCH_VERSION_2_1)): + (not compile_args[0].startswith(_PYTORCH_VERSION_2_1)) and \ + (not compile_args[0].startswith(_PYTORCH_VERSION_2_2)): print('Currently supported Pytorch version is %s/%s, we got %s.' - % (_PYTORCH_VERSION_1_11, _PYTORCH_VERSION_2_0, _PYTORCH_VERSION_2_1, compile_args[0])) + % (_PYTORCH_VERSION_1_11, _PYTORCH_VERSION_2_0, _PYTORCH_VERSION_2_1, _PYTORCH_VERSION_2_2, compile_args[0])) continue except subprocess.CalledProcessError: print('Pytorch is not installed or does not work properly.') diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py index 0175905676..079c655601 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py @@ -41,7 +41,7 @@ except ImportError: else: is_gpu = False -torch_without_guard_version_list = ['2.1'] +torch_without_guard_version_list = ['2.1', '2.2'] for version in torch_without_guard_version_list: if torch.__version__.startswith(version): torch_without_guard_version = True @@ -198,6 +198,8 @@ class VersionCheck: V1_11 = "1.11" V2_0 = "2.0" V2_1 = "2.1" + V2_2 = "2.2" + @staticmethod def check_torch_version(version): diff --git a/debug/accuracy_tools/ptdbg_ascend/test/ut/test_common_util.py b/debug/accuracy_tools/ptdbg_ascend/test/ut/test_common_util.py index 61cbf29f21..5d9394a20c 100644 --- a/debug/accuracy_tools/ptdbg_ascend/test/ut/test_common_util.py +++ b/debug/accuracy_tools/ptdbg_ascend/test/ut/test_common_util.py @@ -13,9 +13,12 @@ class TestCommonUtilsMethods(unittest.TestCase): V1_11 = "1.11" V2_0 = "2.0" V2_1 = "2.1" + V2_2 = "2.2" version_check = common.VersionCheck self.assertFalse(version_check.check_torch_version(V0_1)) - self.assertTrue(version_check.check_torch_version(V1_8) or version_check.check_torch_version(V1_11) or version_check.check_torch_version(V2_0) or version_check.check_torch_version(V2_1)) + self.assertTrue(version_check.check_torch_version(V1_8) or version_check.check_torch_version(V1_11) or + version_check.check_torch_version(V2_0) or version_check.check_torch_version(V2_1) + or version_check.check_torch_version(V2_2)) def test_check_mode_valid(self): mode_check = common.check_mode_valid -- Gitee From eea845b51bace2e085db08e4be5253e97aeb7d28 Mon Sep 17 00:00:00 2001 From: gitee Date: Fri, 19 Apr 2024 16:08:13 +0800 Subject: [PATCH 2/2] fix --- debug/accuracy_tools/ptdbg_ascend/configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/configure.py b/debug/accuracy_tools/ptdbg_ascend/configure.py index ed7f3fe8c5..3508896fba 100644 --- a/debug/accuracy_tools/ptdbg_ascend/configure.py +++ b/debug/accuracy_tools/ptdbg_ascend/configure.py @@ -83,7 +83,7 @@ def setup_python(env_path): (not compile_args[0].startswith(_PYTORCH_VERSION_2_0)) and \ (not compile_args[0].startswith(_PYTORCH_VERSION_2_1)) and \ (not compile_args[0].startswith(_PYTORCH_VERSION_2_2)): - print('Currently supported Pytorch version is %s/%s, we got %s.' + print('Currently supported Pytorch version is %s/%s/%s/%s, we got %s.' % (_PYTORCH_VERSION_1_11, _PYTORCH_VERSION_2_0, _PYTORCH_VERSION_2_1, _PYTORCH_VERSION_2_2, compile_args[0])) continue except subprocess.CalledProcessError: -- Gitee