From 2205c1e4bf09b205a9522ab84b97f5bfac48ef83 Mon Sep 17 00:00:00 2001 From: gitee Date: Wed, 15 Nov 2023 09:54:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4torch1.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/accuracy_tools/ptdbg_ascend/configure.py | 8 +++----- .../ptdbg_ascend/src/python/ptdbg_ascend/common/utils.py | 1 - .../python/ptdbg_ascend/hook_module/wrap_functional.py | 2 +- .../ptdbg_ascend/test/ut/test_common_util.py | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/configure.py b/debug/accuracy_tools/ptdbg_ascend/configure.py index b914b32e9f9..dc55c839cb6 100644 --- a/debug/accuracy_tools/ptdbg_ascend/configure.py +++ b/debug/accuracy_tools/ptdbg_ascend/configure.py @@ -15,7 +15,6 @@ import os import subprocess import sys -_PYTORCH_VERSION_1_8 = "1.8" _PYTORCH_VERSION_1_11 = "1.11" _PYTORCH_VERSION_2_0 = "2.0" _PYTORCH_VERSION_2_1 = "2.1" @@ -50,7 +49,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.8/1.11/2.0/2.1 site-packages installed. [Default ' + 'pytorch 1.11/2.0/2.1 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 @@ -77,12 +76,11 @@ def setup_python(env_path): python_bin_path, '-c', 'import distutils.sysconfig; import torch; print(torch.__version__ + "|" +' ' "|".join(torch.__path__) + "|" + distutils.sysconfig.get_python_inc())']).split("|") - if (not compile_args[0].startswith(_PYTORCH_VERSION_1_8)) and \ - (not compile_args[0].startswith(_PYTORCH_VERSION_1_11)) and \ + if (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)): print('Currently supported Pytorch version is %s/%s, we got %s.' - % (_PYTORCH_VERSION_1_8, _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, 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 21cae3c52a0..8f64b251a81 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 @@ -157,7 +157,6 @@ class VersionCheck: """ Class for TorchVersion """ - V1_8 = "1.8" V1_11 = "1.11" V2_0 = "2.0" V2_1 = "2.1" diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py index 1ce93812962..c9f5f48ace4 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py @@ -26,7 +26,7 @@ from ..common.file_check_util import FileOpen def remove_dropout(): - if torch.__version__ > "1.8": + if torch.__version__ > "1.11": print_info_log("For precision comparison, the probability p in the dropout method is set to 0.") import torch.nn.functional as F from torch import _VF 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 61cbf29f213..324d68a7299 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 @@ -9,13 +9,12 @@ class TestCommonUtilsMethods(unittest.TestCase): def test_VersionCheck(self): V0_1 = "0.1" - V1_8 = "1.8" V1_11 = "1.11" V2_0 = "2.0" V2_1 = "2.1" 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_11) or version_check.check_torch_version(V2_0) or version_check.check_torch_version(V2_1)) def test_check_mode_valid(self): mode_check = common.check_mode_valid -- Gitee From c4157c51e9120a0dc392952a1eb9955c3781fd7d Mon Sep 17 00:00:00 2001 From: jiangchangting1 Date: Thu, 16 Nov 2023 07:55:38 +0000 Subject: [PATCH 2/2] update debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py. Signed-off-by: jiangchangting1 --- .../src/python/ptdbg_ascend/hook_module/wrap_functional.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py index c9f5f48ace4..1ce93812962 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/hook_module/wrap_functional.py @@ -26,7 +26,7 @@ from ..common.file_check_util import FileOpen def remove_dropout(): - if torch.__version__ > "1.11": + if torch.__version__ > "1.8": print_info_log("For precision comparison, the probability p in the dropout method is set to 0.") import torch.nn.functional as F from torch import _VF -- Gitee