From d72d833a9675bd16ac959b97542e25676b50a331 Mon Sep 17 00:00:00 2001 From: Przemyslaw Wysocki Date: Mon, 17 Apr 2023 11:30:17 +0200 Subject: [PATCH] [PyOV] Enable Python 3.11 (#15144) * Bump ONNX version * Bump protobuf * Add xfails and skips * Add tickets * Skip ONNX Serialization tests * Compile ONNX with C++17 * Force cpp17 - 2 * Use MSVC check * Relax python reqs, enable 311 in azure * Fix setupvars error * Ignore watchdog error * Update tensorflow * Minor change * Bump onnx to 1.13.1 * Bump protobuf to 3.20.3 * Debug test tf * Xfail tests in comp * Update comp tests * Update tf reqs * Remove deprecated ONNX function * Align PDPD FE protobuf req with 2.4.1 * Satisfy dependency review * Attempt to fix dependency review * Revert pdpd protobuf * Skip pdpd tests * Fix MO-TF-PB test * Skip TF test case * Enable py311 on rest of jobs * Try disabling pdpd req * Exclude pdpd form cmake * Update .ci/azure/linux.yml Fixed unmerged merge-conflict * CR * Fix reqs * Skip pdpd tests * Disable pdpd tests building in cmake * Skip another pdpd cmake * Add file * Add paddle constraint to tests * Disable paddle reqs * Debug prints * Skip TF test if Python ver is 3.11 * Apply Mish cr comments * Debug * Debug * Constrain tensorflow_addons * Fix pdpd skipping * Add debug prints * Update skips * Remove prints * Minor change * Update OMZ commit * Fix some tests * Minor change * Disable pdpd at all * Disable pdpd at all --------- Co-authored-by: Ilya Lavrenov --- .ci/azure/android_arm64.yml | 4 +- .ci/azure/linux.yml | 7 +- .ci/azure/linux_arm64.yml | 4 +- .ci/azure/linux_conditional_compilation.yml | 4 +- .ci/azure/linux_coverity.yml | 4 +- .ci/azure/linux_onnxruntime.yml | 4 +- .ci/azure/mac.yml | 8 +- .ci/azure/windows.yml | 23 ++--- .ci/azure/windows_conditional_compilation.yml | 4 +- .../ncc_naming_style/ncc_naming_style.cmake | 2 + cmake/test_model_zoo.cmake | 7 +- scripts/setupvars/setupvars.bat | 2 +- scripts/setupvars/setupvars.sh | 2 +- src/bindings/python/constraints.txt | 2 +- src/frontends/paddle/CMakeLists.txt | 7 +- tests/constraints.txt | 1 + .../py_frontend_tests/test_paddle_frontend.py | 54 +++++++----- tests/layer_tests/requirements.txt | 6 +- .../tensorflow_tests/test_tf_UnaryOps.py | 87 ++++++++++++++++++- thirdparty/open_model_zoo | 2 +- .../mo/unit_tests/mo/frontend_ngraph_test.py | 1 + 21 files changed, 163 insertions(+), 72 deletions(-) diff --git a/.ci/azure/android_arm64.yml b/.ci/azure/android_arm64.yml index d385326d4b8..956de5b737d 100644 --- a/.ci/azure/android_arm64.yml +++ b/.ci/azure/android_arm64.yml @@ -57,7 +57,7 @@ jobs: SHARE_DIR: /mount/cinfsshare/onnxtestdata CCACHE_DIR: $(SHARE_DIR)/ccache/master/android_arm64 LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -67,7 +67,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 997db08fb2b..78ef84944cf 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -100,7 +100,7 @@ jobs: BUILD_PYTHON: $(WORK_DIR)/build_python INSTALL_PYTHON: $(INSTALL_OPENVINO)/extras/python LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -110,7 +110,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash @@ -172,7 +172,8 @@ jobs: # For running Python API tests python3 -m pip install -r $(REPO_DIR)/src/bindings/python/src/compatibility/openvino/requirements-dev.txt # For running Paddle frontend unit tests - python3 -m pip install -r $(REPO_DIR)/src/frontends/paddle/tests/requirements.txt + # TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904) + #python3 -m pip install -r $(REPO_DIR)/src/frontends/paddle/tests/requirements.txt # For running ONNX frontend unit tests python3 -m pip install -r $(REPO_DIR)/src/frontends/onnx/tests/requirements.txt # For running TensorFlow frontend unit tests diff --git a/.ci/azure/linux_arm64.yml b/.ci/azure/linux_arm64.yml index 42d2008c6b3..c65551c7f57 100644 --- a/.ci/azure/linux_arm64.yml +++ b/.ci/azure/linux_arm64.yml @@ -81,7 +81,7 @@ jobs: OPENCV_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64_opencv ONETBB_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64_onetbb LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -91,7 +91,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash diff --git a/.ci/azure/linux_conditional_compilation.yml b/.ci/azure/linux_conditional_compilation.yml index 0f6cd577b3a..1aa913eef2e 100644 --- a/.ci/azure/linux_conditional_compilation.yml +++ b/.ci/azure/linux_conditional_compilation.yml @@ -59,7 +59,7 @@ jobs: INSTALL_DIR: $(WORK_DIR)/install_pkg SETUPVARS: $(INSTALL_DIR)/setupvars.sh LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -69,7 +69,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash diff --git a/.ci/azure/linux_coverity.yml b/.ci/azure/linux_coverity.yml index 05a25f8ae8c..309cddcaab6 100644 --- a/.ci/azure/linux_coverity.yml +++ b/.ci/azure/linux_coverity.yml @@ -33,7 +33,7 @@ jobs: SHARE_DIR: /mount/cinfsshare/onnxtestdata CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_coverity LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -43,7 +43,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash diff --git a/.ci/azure/linux_onnxruntime.yml b/.ci/azure/linux_onnxruntime.yml index 9a6c102ae8b..120faa65e03 100644 --- a/.ci/azure/linux_onnxruntime.yml +++ b/.ci/azure/linux_onnxruntime.yml @@ -56,7 +56,7 @@ jobs: ONNXRUNTIME_UTILS: $(REPO_DIR)/.ci/azure/ci_utils/onnxruntime ONNXRUNTIME_BUILD_DIR: $(ONNXRUNTIME_REPO_DIR)/build LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib - OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache + OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache steps: - task: UsePythonVersion@0 @@ -66,7 +66,7 @@ jobs: disableDownloadFromRegistry: false architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - bash: | #!/bin/bash diff --git a/.ci/azure/mac.yml b/.ci/azure/mac.yml index 4fc27e076e4..d2df7e3b462 100644 --- a/.ci/azure/mac.yml +++ b/.ci/azure/mac.yml @@ -73,11 +73,11 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.10' + versionSpec: '3.11.2' addToPath: true architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - script: | @@ -113,10 +113,6 @@ jobs: lfs: 'true' path: testdata - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.10' - - script: | brew install cython brew install automake diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index c9b8036e83d..2f958a92ed3 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -73,7 +73,7 @@ jobs: INSTALL_DIR: $(WORK_DIR)\install_pkg INSTALL_TEST_DIR: $(INSTALL_DIR)\tests SETUPVARS: $(INSTALL_DIR)\setupvars.bat - PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.10.7\x64 + PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.11.2\x64 CMAKE_VERSION: 3.24.0 CMAKE_CMD: $(WORK_DIR)\cmake-$(CMAKE_VERSION)-windows-x86_64\cmake-$(CMAKE_VERSION)-windows-x86_64\bin\cmake.exe OV_CMAKE_TOOLCHAIN_FILE: $(REPO_DIR)\cmake\toolchains\mt.runtime.win32.toolchain.cmake @@ -84,26 +84,26 @@ jobs: - script: | rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR) rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR) - rd /Q /S $(WORK_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.10.7 - rd /Q /S $(BUILD_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.10.7\x64 + rd /Q /S $(WORK_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.11.2 + rd /Q /S $(BUILD_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.11.2\x64 rd /Q /S $(BUILD_SAMPLES_DIR) & mkdir $(BUILD_SAMPLES_DIR) rd /Q /S $(BUILD_SAMPLES_TESTS_DIR) & mkdir $(BUILD_SAMPLES_TESTS_DIR) displayName: 'Make dir' - - script: curl -O https://www.python.org/ftp/python/3.10.7/python-3.10.7-amd64.exe + - script: curl -O https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe displayName: 'Download Python' workingDirectory: $(WORK_DIR) - script: | - python-3.10.7-amd64.exe /passive InstallAllUsers=0 Include_launcher=0 TargetDir=C:\hostedtoolcache\windows\Python\3.10.7\x64 - cp C:\hostedtoolcache\windows\Python\3.8.2\x64.complete C:\hostedtoolcache\windows\Python\3.10.7\x64.complete + python-3.11.2-amd64.exe /passive InstallAllUsers=0 Include_launcher=0 TargetDir=C:\hostedtoolcache\windows\Python\3.11.2\x64 + cp C:\hostedtoolcache\windows\Python\3.8.2\x64.complete C:\hostedtoolcache\windows\Python\3.11.2\x64.complete displayName: 'Install Python' workingDirectory: $(WORK_DIR) - task: UsePythonVersion@0 displayName: 'Use Python' inputs: - versionSpec: '3.10' + versionSpec: '3.11.2' disableDownloadFromRegistry: true - script: | @@ -142,7 +142,8 @@ jobs: python -m pip install -r $(REPO_DIR)\src\bindings\python\wheel\requirements-dev.txt python -m pip install -r $(REPO_DIR)\src\bindings\python\requirements.txt rem For running Paddle frontend unit tests - python -m pip install -r $(REPO_DIR)\src\frontends\paddle\tests\requirements.txt + # TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904) + #python -m pip install -r $(REPO_DIR)\src\frontends\paddle\tests\requirements.txt rem For running ONNX frontend unit tests python -m pip install -r $(REPO_DIR)\src\frontends\onnx\tests\requirements.txt rem For running TensorFlow frontend unit tests @@ -177,9 +178,9 @@ jobs: -DENABLE_PYTHON=ON ^ -DBUILD_nvidia_plugin=OFF ^ -DCUSTOM_OPERATIONS="calculate_grid;complex_mul;fft;grid_sample;sparse_conv;sparse_conv_transpose" ^ - -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.10.7\x64\python.exe" ^ - -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.10.7\x64\include" ^ - -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.10.7\x64\libs\python310.lib" ^ + -DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.11.2\x64\python.exe" ^ + -DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.11.2\x64\include" ^ + -DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.11.2\x64\libs\python311.lib" ^ -DOPENVINO_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules ^ -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" ^ -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" ^ diff --git a/.ci/azure/windows_conditional_compilation.yml b/.ci/azure/windows_conditional_compilation.yml index 46c0528205c..cdca66e6e7c 100644 --- a/.ci/azure/windows_conditional_compilation.yml +++ b/.ci/azure/windows_conditional_compilation.yml @@ -65,11 +65,11 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.10' + versionSpec: '3.11.2' addToPath: true architecture: 'x64' githubToken: $(auth_token) - displayName: Setup Python 3.10 + displayName: Setup Python 3.11 name: setupPython - script: | diff --git a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake index e463cb7b347..0a80c79eae6 100644 --- a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake +++ b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake @@ -27,6 +27,8 @@ elseif(PYTHON_VERSION_MINOR EQUAL 9) set(clang_version 12) elseif(PYTHON_VERSION_MINOR EQUAL 10) set(clang_version 14) +elseif(PYTHON_VERSION_MINOR EQUAL 11) + set(clang_version 14) else() message(WARNING "Cannot suggest clang package for python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") endif() diff --git a/cmake/test_model_zoo.cmake b/cmake/test_model_zoo.cmake index 9929b963c4c..a8a7d4cc025 100644 --- a/cmake/test_model_zoo.cmake +++ b/cmake/test_model_zoo.cmake @@ -87,9 +87,10 @@ if(ENABLE_TESTS) ${ft_out_files} ${onnx_fe_out_files}) - if (ENABLE_OV_PADDLE_FRONTEND) - add_dependencies(test_model_zoo paddle_test_models) - endif() + # TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904) + #if (ENABLE_OV_PADDLE_FRONTEND) + # add_dependencies(test_model_zoo paddle_test_models) + #endif() install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo" DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/scripts/setupvars/setupvars.bat b/scripts/setupvars/setupvars.bat index 71256160263..d25a910317d 100644 --- a/scripts/setupvars/setupvars.bat +++ b/scripts/setupvars/setupvars.bat @@ -71,7 +71,7 @@ set "PATH=%OPENVINO_LIB_PATHS%;%PATH%" :: Check if Python is installed set PYTHON_VERSION_MAJOR=3 set MIN_REQUIRED_PYTHON_VERSION_MINOR=7 -set MAX_SUPPORTED_PYTHON_VERSION_MINOR=10 +set MAX_SUPPORTED_PYTHON_VERSION_MINOR=11 python --version 2>NUL if errorlevel 1 (call :python_not_installed) else (call :check_python_version) diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index c9bcc61c643..e7e89c86779 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -101,7 +101,7 @@ fi PYTHON_VERSION_MAJOR="3" MIN_REQUIRED_PYTHON_VERSION_MINOR="7" -MAX_SUPPORTED_PYTHON_VERSION_MINOR="10" +MAX_SUPPORTED_PYTHON_VERSION_MINOR="11" check_python_version () { if [ -z "$python_version" ]; then diff --git a/src/bindings/python/constraints.txt b/src/bindings/python/constraints.txt index 675b59a934d..582da3f7250 100644 --- a/src/bindings/python/constraints.txt +++ b/src/bindings/python/constraints.txt @@ -18,6 +18,6 @@ wheel>=0.38.1 # Frontends docopt~=0.6.2 -paddlepaddle==2.4.2; python_version<'3.11' +paddlepaddle==2.4.2; python_version <= '3.10' tensorflow>=1.15.5,<2.13.0 six~=1.16.0 \ No newline at end of file diff --git a/src/frontends/paddle/CMakeLists.txt b/src/frontends/paddle/CMakeLists.txt index e11be311e03..656cc0f1951 100644 --- a/src/frontends/paddle/CMakeLists.txt +++ b/src/frontends/paddle/CMakeLists.txt @@ -4,6 +4,7 @@ add_subdirectory(src) -if(ENABLE_TESTS) - add_subdirectory(tests) -endif() +# ticket 95904 +#if(ENABLE_TESTS AND Python_VERSION_MINOR LESS 11) +# add_subdirectory(tests) +#endif() diff --git a/tests/constraints.txt b/tests/constraints.txt index 9f85bf10182..1b9bcfb8f87 100644 --- a/tests/constraints.txt +++ b/tests/constraints.txt @@ -13,6 +13,7 @@ fastjsonschema~=2.15.1 test-generator==0.1.2 requests>=2.25.1 opencv-python>=4.5 +paddlepaddle==2.4.2 py>=1.9.0 pytest>=5.0,<7.3 pytest-dependency==0.5.1 diff --git a/tests/layer_tests/py_frontend_tests/test_paddle_frontend.py b/tests/layer_tests/py_frontend_tests/test_paddle_frontend.py index df5bdae007b..a4793280931 100644 --- a/tests/layer_tests/py_frontend_tests/test_paddle_frontend.py +++ b/tests/layer_tests/py_frontend_tests/test_paddle_frontend.py @@ -5,14 +5,14 @@ from pathlib import Path import os import glob import re - -import paddle -from paddle.jit import to_static -from paddle.static import InputSpec -import pytest - import sys -print(sys.path) + +# ticket 95904 +#import paddle +#from paddle.jit import to_static +#from paddle.static import InputSpec + +import pytest from openvino.frontend import FrontEndManager from openvino.runtime import shutdown @@ -31,26 +31,29 @@ def skip_if_paddle_frontend_is_disabled(): pytest.skip() -def create_paddle_model(): - @to_static() - def test(x): - return paddle.nn.functional.relu6(x) - x_spec = InputSpec(shape=[None, 3], dtype="float32", name="x") - paddle.jit.save(test, path=paddle_relu6_model_basename, input_spec=[x_spec, ]) +# ticket 95904 +#def create_paddle_model(): + #@to_static() + #def test(x): + # return paddle.nn.functional.relu6(x) + #x_spec = InputSpec(shape=[None, 3], dtype="float32", name="x") + #paddle.jit.save(test, path=paddle_relu6_model_basename, input_spec=[x_spec, ]) -def create_concat_model(): - @to_static() - def test(x, y): - return paddle.concat([x, y], axis=0) - x_spec = InputSpec(shape=[None, 3], dtype="float32", name="x") - y_spec = InputSpec(shape=[None, 3], dtype="float32", name="y") - paddle.jit.save(test, path=paddle_concat_model_basename, input_spec=[x_spec, y_spec]) +# ticket 95904 +#def create_concat_model(): + #@to_static() + #def test(x, y): + # return paddle.concat([x, y], axis=0) + #x_spec = InputSpec(shape=[None, 3], dtype="float32", name="x") + #y_spec = InputSpec(shape=[None, 3], dtype="float32", name="y") + #paddle.jit.save(test, path=paddle_concat_model_basename, input_spec=[x_spec, y_spec]) -def setup_module(): - create_paddle_model() - create_concat_model() +# ticket 95904 +#def setup_module(): + #create_paddle_model() + #create_concat_model() def teardown_module(): @@ -59,6 +62,7 @@ def teardown_module(): shutdown() +@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904") def test_paddle_conversion_extension(): skip_if_paddle_frontend_is_disabled() @@ -89,6 +93,7 @@ def test_paddle_conversion_extension(): assert invoked +@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904") def test_op_extension_via_paddle_extension_set_attrs_values(): skip_if_paddle_frontend_is_disabled() @@ -109,6 +114,7 @@ def test_op_extension_via_paddle_extension_set_attrs_values(): assert model +@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904") def test_op_extension_via_frontend_extension_set_attrs_values(): skip_if_paddle_frontend_is_disabled() @@ -142,6 +148,7 @@ def get_builtin_extensions_path(): raise RuntimeError("Unable to find test_builtin_extensions") +@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904") def test_so_extension_via_frontend_convert_input_model(): skip_if_paddle_frontend_is_disabled() @@ -157,6 +164,7 @@ def test_so_extension_via_frontend_convert_input_model(): assert all(op.get_type_name() != "Clamp" for op in model.get_ops()) +@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904") def test_so_extension_via_frontend_decode_input_model(): skip_if_paddle_frontend_is_disabled() diff --git a/tests/layer_tests/requirements.txt b/tests/layer_tests/requirements.txt index 9e5dac3036d..a182efac32a 100644 --- a/tests/layer_tests/requirements.txt +++ b/tests/layer_tests/requirements.txt @@ -1,8 +1,8 @@ -c ../constraints.txt -requests +# paddlepaddle # ticket 95904 numpy +requests torch torchvision -paddlepaddle; python_version<'3.11' pytest -tensorflow-addons +tensorflow-addons; python_version <= '3.10' diff --git a/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py b/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py index b2ed7ad562a..bd767239ed9 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_UnaryOps.py @@ -3,6 +3,7 @@ import numpy as np import pytest +import sys from common.layer_test_class import check_ir_version from common.tf_layer_test_class import CommonTFLayerTest from common.utils.tf_utils import permute_nchw_to_nhwc @@ -46,15 +47,65 @@ class TestUnaryOps(CommonTFLayerTest): return inputs_dict + def create_net_with_mish(self, shape, ir_version, use_new_frontend): + """ + TODO: Move functionality to `create_net_with_unary_op()` once tensorflow_addons + supports Python 3.11 + Tensorflow net IR net + + Input->mish => Input->mish + """ + import tensorflow as tf + import tensorflow_addons as tfa + + tf.compat.v1.reset_default_graph() + + with tf.compat.v1.Session() as sess: + tf_x_shape = shape.copy() + tf_x_shape = permute_nchw_to_nhwc(tf_x_shape, use_new_frontend) + + input = tf.compat.v1.placeholder(tf.float32, tf_x_shape, 'Input') + tfa.activations.mish(input) + + tf.compat.v1.global_variables_initializer() + tf_net = sess.graph_def + + # + # Create reference IR net + # Please, specify 'type': 'Input' for input node + # Moreover, do not forget to validate ALL layer attributes!!! + # + + ref_net = None + + if check_ir_version(10, None, ir_version) and not use_new_frontend: + nodes_attributes = { + 'input': {'kind': 'op', 'type': 'Parameter'}, + 'input_data': {'shape': shape, 'kind': 'data'}, + 'testing_op': {'kind': 'op', 'type': 'Mish'}, + 'testing_data': {'shape': shape, 'kind': 'data'}, + 'result': {'kind': 'op', 'type': 'Result'} + } + + ref_net = build_graph(nodes_attributes, + [('input', 'input_data'), + ('input_data', 'testing_op'), + ('testing_op', 'testing_data'), + ('testing_data', 'result') + ]) + + return tf_net, ref_net + def create_net_with_unary_op(self, shape, ir_version, op_type, use_new_frontend): """ + TODO: Move functionality of `create_net_with_mish()` here once tensorflow_addons + supports Python 3.11 Tensorflow net IR net Input->UnaryOp => Input->UnaryOp """ import tensorflow as tf - import tensorflow_addons as tfa self.current_op_type = op_type op_type_to_tf = { @@ -74,7 +125,7 @@ class TestUnaryOps(CommonTFLayerTest): 'Floor': tf.math.floor, 'Log': tf.math.log, 'LogicalNot': tf.math.logical_not, - 'Mish': tfa.activations.mish, + #'Mish': tfa.activations.mish, # temporarily moved to `create_net_with_mish()` 'Negative': tf.math.negative, 'Sigmoid': tf.nn.sigmoid, 'Sign': tf.math.sign, @@ -162,7 +213,6 @@ class TestUnaryOps(CommonTFLayerTest): 'LogicalNot', 'Square', 'Erf', - 'Mish', ]) @pytest.mark.precommit def test_unary_op_precommit(self, params, ie_device, precision, ir_version, temp_dir, op_type, @@ -173,6 +223,21 @@ class TestUnaryOps(CommonTFLayerTest): use_new_frontend=use_new_frontend), ie_device, precision, ir_version, temp_dir=temp_dir, use_new_frontend=use_new_frontend, use_old_api=use_old_api) + + @pytest.mark.xfail(sys.version_info > (3, 10), reason="tensorflow_addons package is not available for Python 3.11 and higher") + @pytest.mark.parametrize("params", test_data_precommit) + @pytest.mark.precommit + def test_unary_op_mish_precommit(self, params, ie_device, precision, ir_version, temp_dir, + use_new_frontend, use_old_api): + """ + TODO: Move to `test_unary_op_precommit()` once tensorflow_addons package is available for Python 3.11 + """ + if ie_device == 'GPU': + pytest.skip("5D tensors is not supported on GPU") + self._test(*self.create_net_with_mish(**params, ir_version=ir_version, + use_new_frontend=use_new_frontend), + ie_device, precision, ir_version, temp_dir=temp_dir, + use_new_frontend=use_new_frontend, use_old_api=use_old_api) test_data = [pytest.param(dict(shape=[10, 12]), marks=pytest.mark.precommit_tf_fe), dict(shape=[8, 10, 12]), @@ -206,7 +271,6 @@ class TestUnaryOps(CommonTFLayerTest): 'Asinh', 'Square', 'Erf', - 'Mish', ]) @pytest.mark.nightly def test_unary_op(self, params, ie_device, precision, ir_version, temp_dir, op_type, @@ -217,3 +281,18 @@ class TestUnaryOps(CommonTFLayerTest): use_new_frontend=use_new_frontend), ie_device, precision, ir_version, temp_dir=temp_dir, use_new_frontend=use_new_frontend, use_old_api=use_old_api) + + @pytest.mark.xfail(sys.version_info > (3, 10), reason="tensorflow_addons package is not available for Python 3.11 and higher") + @pytest.mark.parametrize("params", test_data) + @pytest.mark.nightly + def test_unary_op_mish(self, params, ie_device, precision, ir_version, temp_dir, op_type, + use_new_frontend, use_old_api): + """ + TODO: Move to `test_unary_op()` once tensorflow_addons package is available for Python 3.11 + """ + if ie_device == 'GPU': + pytest.skip("5D tensors is not supported on GPU") + self._test(*self.create_net_with_mish(**params, ir_version=ir_version, + use_new_frontend=use_new_frontend), + ie_device, precision, ir_version, temp_dir=temp_dir, + use_new_frontend=use_new_frontend, use_old_api=use_old_api) diff --git a/thirdparty/open_model_zoo b/thirdparty/open_model_zoo index 8cf18447523..ec74a9f08b2 160000 --- a/thirdparty/open_model_zoo +++ b/thirdparty/open_model_zoo @@ -1 +1 @@ -Subproject commit 8cf18447523e17bc2daa55b5123e6bc352d0eb20 +Subproject commit ec74a9f08b207c0d0cfbcd8840929611b7c9d3cb diff --git a/tools/mo/unit_tests/mo/frontend_ngraph_test.py b/tools/mo/unit_tests/mo/frontend_ngraph_test.py index fc624316bc9..4c44d61aeb9 100644 --- a/tools/mo/unit_tests/mo/frontend_ngraph_test.py +++ b/tools/mo/unit_tests/mo/frontend_ngraph_test.py @@ -109,6 +109,7 @@ def test_mo_extensions_test(): assert not status.returncode +@pytest.mark.skipif(sys.version_info > (3, 10), reason="Ticket: 95904") def test_mo_fallback_test(): setup_env() args = [sys.executable, '-m', 'pytest',