From 0b8237f5084ebf2a72ebfccc66ed9ed3e92a99a0 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 18 Sep 2023 06:59:56 +0400 Subject: [PATCH 01/12] Removed testdata repo usage (#19890) --- .ci/azure/linux.yml | 14 -- .ci/azure/linux_arm64.yml | 1 - .ci/azure/linux_cuda.yml | 8 - .ci/azure/linux_debian.yml | 21 --- .ci/azure/linux_lohika.yml | 8 - .ci/azure/mac.yml | 18 --- .ci/azure/windows.yml | 12 -- .github/labeler.yml | 3 + .github/workflows/code_snippets.yml | 5 +- .github/workflows/code_style.yml | 6 +- .github/workflows/coverage.yml | 4 +- .github/workflows/linux.yml | 16 +- .github/workflows/linux_android_arm64.yml | 10 +- .github/workflows/linux_arm64.yml | 5 +- .../linux_conditional_compilation.yml | 6 +- .github/workflows/linux_debian.yml | 12 +- .github/workflows/mo.yml | 3 +- .github/workflows/py_checks.yml | 4 +- .github/workflows/windows.yml | 23 +-- .../windows_conditional_compilation.yml | 6 +- cmake/dependencies.cmake | 16 -- .../download/dependency_solver.cmake | 2 + cmake/developer_package/models.cmake | 12 +- cmake/features.cmake | 2 - install_build_dependencies.sh | 2 - src/bindings/c/tests/test_model_repo.cpp | 12 ++ src/bindings/c/tests/test_model_repo.hpp | 15 +- .../tests/deprecated/helpers/CMakeLists.txt | 8 - .../deprecated/helpers/test_model_path.cpp | 150 ------------------ .../deprecated/helpers/test_model_path.hpp | 62 -------- .../tests/deprecated/helpers/tests_common.hpp | 1 - .../intel_gna/tests/functional/CMakeLists.txt | 4 - .../functional/helpers/test_model_repo.cpp | 18 +-- .../functional/helpers/test_model_repo.hpp | 27 ---- 34 files changed, 64 insertions(+), 452 deletions(-) delete mode 100644 src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.cpp delete mode 100644 src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.hpp diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 91c6ee5814e6f0..3519952ecd4101 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -34,12 +34,6 @@ resources: name: openvinotoolkit/openvino_contrib ref: master - - repository: testdata - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/testdata - ref: master - variables: - group: github @@ -83,7 +77,6 @@ jobs: BUILD_TYPE: Release REPO_DIR: $(Build.Repository.LocalPath) OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)/../openvino_contrib - MODELS_PATH: $(REPO_DIR)/../testdata WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build BUILD_SAMPLES_DIR: $(WORK_DIR)/build_samples @@ -216,13 +209,6 @@ jobs: echo SourceBranch: $(Build.SourceBranch) displayName: 'System info' - - # Should be after 'Install dependencies' because Git lfs is not installed - - checkout: testdata - clean: 'true' - lfs: 'true' - path: testdata - - task: CMake@1 inputs: # CMake must get Python 3.x version by default diff --git a/.ci/azure/linux_arm64.yml b/.ci/azure/linux_arm64.yml index 618af65e537ea2..62840d46200de5 100644 --- a/.ci/azure/linux_arm64.yml +++ b/.ci/azure/linux_arm64.yml @@ -195,7 +195,6 @@ jobs: -DPYTHON_MODULE_EXTENSION=$(aarch64-linux-gnu-python3-config --extension-suffix) \ -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libc-2.31.so \ -DPYTHON_INCLUDE_DIR=$(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/include/python$(OV_PYTHON_VERSION_MAJOR_MINOR) \ - -DENABLE_DATA=OFF \ -DENABLE_TESTS=ON \ -DENABLE_SYSTEM_TBB=ON \ -DENABLE_SYSTEM_PROTOBUF=ON \ diff --git a/.ci/azure/linux_cuda.yml b/.ci/azure/linux_cuda.yml index b92e6e0ba70b79..09e75560937229 100644 --- a/.ci/azure/linux_cuda.yml +++ b/.ci/azure/linux_cuda.yml @@ -39,12 +39,6 @@ resources: name: openvinotoolkit/openvino_contrib ref: master - - repository: testdata - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/testdata - ref: master - jobs: - job: CUDAPlugin_Lin timeoutInMinutes: '60' @@ -60,7 +54,6 @@ jobs: HOME_DIR: $(Agent.HomeDirectory) REPO_DIR: $(Build.Repository.LocalPath) OPENVINO_REPO_DIR: $(REPO_DIR)/../openvino - MODELS_PATH: $(REPO_DIR)/../testdata WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build BIN_DIR: $(OPENVINO_REPO_DIR)/bin/intel64/$(BUILD_TYPE) @@ -137,7 +130,6 @@ jobs: -DENABLE_OV_ONNX_FRONTEND=OFF \ -DENABLE_PYTHON=OFF \ -DENABLE_TESTS=ON \ - -DENABLE_DATA=OFF \ -S /root/repos/openvino \ -B /root/w/build && cmake --build /root/w/build --parallel --config Release --verbose -- ov_nvidia_func_tests ov_nvidia_unit_tests" diff --git a/.ci/azure/linux_debian.yml b/.ci/azure/linux_debian.yml index 690ad5c2c95cb1..96db6129c72ee1 100644 --- a/.ci/azure/linux_debian.yml +++ b/.ci/azure/linux_debian.yml @@ -28,14 +28,6 @@ pr: - '*/conformance/*' - 'tests/layer_tests/*' -resources: - repositories: - - repository: testdata - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/testdata - ref: master - jobs: - job: Lin_Debian # About 150% of total time @@ -50,7 +42,6 @@ jobs: VSTS_HTTP_TIMEOUT: 200 BUILD_TYPE: Release REPO_DIR: $(Build.Repository.LocalPath) - MODELS_PATH: $(REPO_DIR)/../testdata WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build BUILD_SAMPLES_DIR: $(WORK_DIR)/build_samples @@ -149,12 +140,6 @@ jobs: git clone https://github.com/google/gtest-parallel.git displayName: 'Install build dependencies' - # Should be after 'Install dependencies' because Git lfs is not installed - - checkout: testdata - clean: 'true' - lfs: 'true' - path: testdata - - task: CMake@1 inputs: # CMake must get Python 3.x version by default @@ -338,15 +323,9 @@ jobs: displayName: 'TEMPLATE FuncTests' - script: $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineCAPITests.xml - env: - DATA_PATH: $(MODELS_PATH) - MODELS_PATH: $(MODELS_PATH) displayName: 'IE CAPITests' - script: $(INSTALL_TEST_DIR)/ov_capi_test --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_capi_test.xml - env: - DATA_PATH: $(MODELS_PATH) - MODELS_PATH: $(MODELS_PATH) displayName: 'OV CAPITests' # Skip test_onnx/test_zoo_models and test_onnx/test_backend due to long execution time diff --git a/.ci/azure/linux_lohika.yml b/.ci/azure/linux_lohika.yml index c9be14cc217dc0..5fb3b59129efa3 100644 --- a/.ci/azure/linux_lohika.yml +++ b/.ci/azure/linux_lohika.yml @@ -20,7 +20,6 @@ jobs: # VSTS_HTTP_TIMEOUT: 200 # BUILD_TYPE: Release # REPO_DIR: $(Build.Repository.LocalPath) -# MODELS_PATH: $(REPO_DIR)/../testdata # WORK_DIR: $(Pipeline.Workspace)/_w # BUILD_DIR: $(WORK_DIR)/build @@ -38,13 +37,6 @@ jobs: - script: git -C ~/work/openvino checkout -m $(Build.SourceVersion) && git -C ~/work/openvino submodule update --init --recursive displayName: checkout - # Should be after 'Install dependencies' because Git lfs is not installed -# - checkout: testdata -# clean: 'true' -# submodules: 'true' -# lfs: 'true' -# path: testdata - - script: env -C ~/work ./configreleasenolto.sh displayName: CMake diff --git a/.ci/azure/mac.yml b/.ci/azure/mac.yml index d39b10e536ed57..f1a20fb49b3055 100644 --- a/.ci/azure/mac.yml +++ b/.ci/azure/mac.yml @@ -37,12 +37,6 @@ resources: name: openvinotoolkit/openvino_contrib ref: master - - repository: testdata - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/testdata - ref: master - variables: - group: github @@ -61,7 +55,6 @@ jobs: BUILD_TYPE: Release REPO_DIR: $(Build.Repository.LocalPath) OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)/../openvino_contrib - MODELS_PATH: $(REPO_DIR)/../testdata WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build INSTALL_DIR: $(WORK_DIR)/install_pkg @@ -109,11 +102,6 @@ jobs: submodules: 'true' path: openvino_contrib - - checkout: testdata - clean: 'true' - lfs: 'true' - path: testdata - - script: | set -e brew install cython automake @@ -219,17 +207,11 @@ jobs: - script: | $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineCAPITests.xml - env: - DATA_PATH: $(MODELS_PATH) - MODELS_PATH: $(MODELS_PATH) displayName: 'IE CAPITests' enabled: 'false' - script: | $(SETUPVARS) && $(INSTALL_TEST_DIR)/ov_capi_test --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_capi_test.xml - env: - DATA_PATH: $(MODELS_PATH) - MODELS_PATH: $(MODELS_PATH) displayName: 'IE CAPITests' enabled: 'false' diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 0c1383b4e7cfe4..f0217b36c10df9 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -34,12 +34,6 @@ resources: name: openvinotoolkit/openvino_contrib ref: master - - repository: testdata - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/testdata - ref: master - jobs: - job: Win strategy: @@ -63,7 +57,6 @@ jobs: BUILD_TYPE: Release REPO_DIR: $(Build.Repository.LocalPath) OPENVINO_CONTRIB_REPO_DIR: $(REPO_DIR)\..\openvino_contrib - MODELS_PATH: $(REPO_DIR)\..\testdata WORK_DIR: $(Pipeline.Workspace)\_w BUILD_DIR: $(WORK_DIR)\build BUILD_SAMPLES_DIR: $(WORK_DIR)\build_samples @@ -130,11 +123,6 @@ jobs: submodules: 'true' path: openvino_contrib - - checkout: testdata - clean: 'true' - lfs: 'true' - path: testdata - - script: | python -m pip install --upgrade pip rem For running Python API tests diff --git a/.github/labeler.yml b/.github/labeler.yml index a8b556ac91e100..77833eb47cdaf3 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -17,6 +17,9 @@ - '.ci/**/*' - 'Jenkinsfile' +'github_actions': +- '.github/workflows/*' + 'category: Core': - 'src/core/**/*' - 'src/common/itt/**/*' diff --git a/.github/workflows/code_snippets.yml b/.github/workflows/code_snippets.yml index 5b014563d94475..581a584b88805f 100644 --- a/.github/workflows/code_snippets.yml +++ b/.github/workflows/code_snippets.yml @@ -27,8 +27,7 @@ jobs: - name: Clone OpenVINO uses: actions/checkout@v4 with: - submodules: recursive - lfs: true + submodules: 'true' - name: Install OpenCL uses: awalsh128/cache-apt-pkgs-action@v1.3.0 @@ -38,7 +37,7 @@ jobs: version: 3.0 - name: CMake configure - run: cmake -DCMAKE_BUILD_TYPE=Release -B build + run: cmake -DCMAKE_BUILD_TYPE=Release -DTHREADING=SEQ -B build - name: Get number of CPU cores uses: SimenB/github-actions-cpu-cores@v2 diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index dbc3245055af47..164a5454465bf5 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: recursive + submodules: 'true' - name: Install clang-format-9 run: | @@ -49,7 +49,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: recursive + submodules: 'true' - name: Install ShellCheck run: | @@ -80,7 +80,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: recursive + submodules: 'true' - name: Install Clang dependency run: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8e375e63cbacc5..d89666b898fa80 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -30,7 +30,7 @@ jobs: - name: Clone OpenVINO uses: actions/checkout@v4 with: - submodules: recursive + submodules: 'true' - name: Install dependencies run: | @@ -108,7 +108,7 @@ jobs: run: ${{ github.workspace }}/bin/intel64/Release/ov_hetero_func_tests - name: Run IR frontend tests - run: ${{ github.workspace }}/bin/intel64/Release/ov_ir_frontend_tests # --gtest_print_time=1 --gtest_output=xml:${{ github.workspace }}/testdata/TEST-IRFrontend.xml + run: ${{ github.workspace }}/bin/intel64/Release/ov_ir_frontend_tests - name: Run ONNX frontend tests run: ${{ github.workspace }}/bin/intel64/Release/ov_onnx_frontend_tests --gtest_filter=-*IE_GPU* diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 22d9037988634b..55111be2453ee6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -46,8 +46,6 @@ jobs: LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests MODEL_HUB_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/model_hub_tests BUILD_DIR: ${{ github.workspace }}/build - DATA_PATH: ${{ github.workspace }}/testdata - MODELS_PATH: ${{ github.workspace }}/testdata OV_TEMP: ${{ github.workspace }}/openvino_temp PYTHON_STATIC_ARGS: -m "not dynamic_library" steps: @@ -55,22 +53,13 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' + submodules: 'true' - name: Clone OpenVINO Contrib uses: actions/checkout@v4 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' - submodules: 'recursive' - - - name: Clone testdata for C API tests - uses: actions/checkout@v4 - with: - repository: 'openvinotoolkit/testdata' - path: 'testdata' - submodules: 'recursive' - lfs: 'true' # # Dependencies @@ -493,8 +482,6 @@ jobs: LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests MODEL_HUB_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/model_hub_tests BUILD_DIR: ${{ github.workspace }}/build - DATA_PATH: ${{ github.workspace }}/testdata - MODELS_PATH: ${{ github.workspace }}/testdata OV_TEMP: ${{ github.workspace }}/openvino_temp PYTHON_STATIC_ARGS: -m "not dynamic_library" @@ -507,7 +494,6 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' # # Dependencies diff --git a/.github/workflows/linux_android_arm64.yml b/.github/workflows/linux_android_arm64.yml index d2106b22b63b55..4d0e40640ac5b5 100644 --- a/.github/workflows/linux_android_arm64.yml +++ b/.github/workflows/linux_android_arm64.yml @@ -55,7 +55,14 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' + + - name: Init submodules for non vcpkg dependencies + run: | + pushd ${{ env.OPENVINO_REPO }} + git submodule update --init -- ${{ env.OPENVINO_REPO }}/src/plugins + git submodule update --init -- ${{ env.OPENVINO_REPO }}/thirdparty/gtest + git submodule update --init -- ${{ env.OPENVINO_REPO }}/thirdparty/open_model_zoo + popd - name: Clone VCPKG uses: actions/checkout@v4 @@ -63,7 +70,6 @@ jobs: repository: 'microsoft/vcpkg' path: 'vcpkg' fetch-depth: '0' - submodules: 'recursive' - name: Setup Python 3.11 uses: actions/setup-python@v4 diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml index a598ca0b5ebe46..3ed58d0ec02de9 100644 --- a/.github/workflows/linux_arm64.yml +++ b/.github/workflows/linux_arm64.yml @@ -44,8 +44,6 @@ jobs: OPENVINO_REPO: ${{ github.workspace }}/openvino BUILD_DIR: ${{ github.workspace }}/build INSTALL_DIR: ${{ github.workspace }}/install - DATA_PATH: ${{ github.workspace }}/testdata - MODELS_PATH: ${{ github.workspace }}/testdata OV_TEMP: ${{ github.workspace }}/openvino_temp steps: - name: Clone OpenVINO @@ -152,7 +150,6 @@ jobs: - name: CMake configure run: | source ${{ env.BUILD_DIR }}/dependencies/conanbuild.sh - # TODO: return tests building once GPU plugin migrates to Plugin API 2.0 cmake \ -G Ninja \ -DCMAKE_VERBOSE_MAKEFILE=ON \ @@ -166,7 +163,7 @@ jobs: -DPYTHON_MODULE_EXTENSION=$(aarch64-linux-gnu-python3-config --extension-suffix) \ -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libc-2.31.so \ -DPYTHON_INCLUDE_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))") \ - -DENABLE_DATA=OFF \ + -DENABLE_TESTS=ON \ -DENABLE_SYSTEM_TBB=ON \ -DENABLE_SYSTEM_PROTOBUF=ON \ -DENABLE_SYSTEM_SNAPPY=ON \ diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index 5522dce84e9c52..8ebad71c82af8d 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -43,7 +43,6 @@ jobs: OPENVINO_REPO: ${{ github.workspace }}/openvino OPENVINO_CONTRIB_REPO: ${{ github.workspace }}/openvino_contrib BUILD_DIR: ${{ github.workspace }}/build - DATA_PATH: ${{ github.workspace }}/testdata MODELS_PATH: ${{ github.workspace }}/testdata OV_TEMP: ${{ github.workspace }}/openvino_temp PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" @@ -52,14 +51,13 @@ jobs: uses: actions/checkout@v3 with: path: 'openvino' - submodules: 'recursive' + submodules: 'true' - - name: Clone testdata for C API tests + - name: Clone test models uses: actions/checkout@v3 with: repository: 'openvinotoolkit/testdata' path: 'testdata' - submodules: 'recursive' lfs: 'true' # diff --git a/.github/workflows/linux_debian.yml b/.github/workflows/linux_debian.yml index 6e65a344764582..b517a368c46ced 100644 --- a/.github/workflows/linux_debian.yml +++ b/.github/workflows/linux_debian.yml @@ -48,8 +48,6 @@ jobs: INSTALL_DIR: ${{ github.workspace }}/install INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests - DATA_PATH: ${{ github.workspace }}/testdata - MODELS_PATH: ${{ github.workspace }}/testdata OV_TEMP: ${{ github.workspace }}/openvino_temp SAMPLES_INSTALL_DIR: /usr/share/openvino/samples PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" @@ -58,15 +56,7 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' - - - name: Clone testdata for C API tests - uses: actions/checkout@v4 - with: - repository: 'openvinotoolkit/testdata' - path: 'testdata' - submodules: 'recursive' - lfs: 'true' + submodules: 'true' - name: Create Directories run: | diff --git a/.github/workflows/mo.yml b/.github/workflows/mo.yml index eab7664a776333..edb2b222e894da 100644 --- a/.github/workflows/mo.yml +++ b/.github/workflows/mo.yml @@ -20,9 +20,8 @@ jobs: Pylint-UT: runs-on: ubuntu-22.04 steps: + - name: Clone OpenVINO - uses: actions/checkout@v4 - with: - submodules: recursive - name: Setup Python uses: actions/setup-python@v4 diff --git a/.github/workflows/py_checks.yml b/.github/workflows/py_checks.yml index 399c118b40a40c..2a2a5741754895 100644 --- a/.github/workflows/py_checks.yml +++ b/.github/workflows/py_checks.yml @@ -24,10 +24,8 @@ jobs: linters: runs-on: ubuntu-20.04 steps: - - name: Code checkout + - name: Clone OpenVINO uses: actions/checkout@v4 - with: - submodules: recursive - name: Setup Python uses: actions/setup-python@v4 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a6c775c42c2d67..680f2686ac63cf 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -36,8 +36,6 @@ env: SAMPLES_INSTALL_DIR: "${{ github.workspace }}\\install\\samples" LAYER_TESTS_INSTALL_DIR: "${{ github.workspace }}\\install\\tests\\layer_tests" BUILD_DIR: "${{ github.workspace }}\\build" - DATA_PATH: "${{ github.workspace }}\\testdata" - MODELS_PATH: "${{ github.workspace }}\\testdata" OV_TEMP: "${{ github.workspace }}\\openvino_temp" PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" VCVARSPATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat" @@ -53,22 +51,13 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' + submodules: 'true' - name: Clone OpenVINO Contrib uses: actions/checkout@v4 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' - submodules: 'recursive' - - - name: Clone testdata for C API tests - uses: actions/checkout@v4 - with: - repository: 'openvinotoolkit/testdata' - path: 'testdata' - submodules: 'recursive' - lfs: 'true' # # Dependencies @@ -265,8 +254,6 @@ jobs: SAMPLES_INSTALL_DIR: "${{ github.workspace }}\\install\\samples" LAYER_TESTS_INSTALL_DIR: "${{ github.workspace }}\\install\\tests\\layer_tests" BUILD_DIR: "${{ github.workspace }}\\build" - DATA_PATH: "${{ github.workspace }}\\testdata" - MODELS_PATH: "${{ github.workspace }}\\testdata" PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" steps: @@ -306,14 +293,6 @@ jobs: uses: actions/checkout@v4 with: path: 'openvino' - submodules: 'recursive' - - - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 - with: - repository: 'openvinotoolkit/openvino_contrib' - path: 'openvino_contrib' - submodules: 'recursive' - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 94c4ec773c268f..1b884811c43316 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -40,7 +40,6 @@ env: LAYER_TESTS_INSTALL_DIR: "${{ github.workspace }}\\install\\tests\\layer_tests" BUILD_DIR: "${{ github.workspace }}\\build" BUILD_DIR_2: "${{ github.workspace }}\\build_s" - DATA_PATH: "${{ github.workspace }}\\testdata" MODELS_PATH: "${{ github.workspace }}\\testdata" OV_TEMP: "${{ github.workspace }}\\openvino_temp" BUILD_TYPE: "Release" @@ -60,14 +59,13 @@ jobs: uses: actions/checkout@v3 with: path: 'openvino' - submodules: 'recursive' + submodules: 'true' - - name: Clone testdata for sample test + - name: Clone test models uses: actions/checkout@v4 with: repository: 'openvinotoolkit/testdata' path: 'testdata' - submodules: 'recursive' lfs: 'true' # diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 0f9683377e18e9..1d4210f300b058 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -7,22 +7,6 @@ cmake_policy(SET CMP0054 NEW) # TODO: fix it, outside of source dir MO cannot find TBB dependency set_temp_directory(TEMP "${CMAKE_SOURCE_DIR}") -if(ENABLE_SAME_BRANCH_FOR_MODELS) - branchName(MODELS_BRANCH) -else() - set(MODELS_BRANCH "master") -endif() - -if(ENABLE_DATA) - add_models_repo(${ENABLE_DATA} "data:https://github.com/openvinotoolkit/testdata.git") - set(MODELS_PATH "${TEMP}/models/src/data") - set(DATA_PATH "${MODELS_PATH}") -endif() - -message(STATUS "MODELS_PATH=" ${MODELS_PATH}) - -fetch_models_and_validation_set() - ## Intel OMP package if(THREADING STREQUAL "OMP") reset_deps_cache(OMP) diff --git a/cmake/developer_package/download/dependency_solver.cmake b/cmake/developer_package/download/dependency_solver.cmake index 0fa2ad53bfbf6d..f3723f650fdeb4 100644 --- a/cmake/developer_package/download/dependency_solver.cmake +++ b/cmake/developer_package/download/dependency_solver.cmake @@ -136,6 +136,8 @@ function (RESOLVE_DEPENDENCY NAME_OF_CMAKE_VAR) endfunction(RESOLVE_DEPENDENCY) function (resolve_model_dependency network archive network_model_path) + message(WARNING "DEPRECATED: 'resolve_model_dependency' must not be used") + RESOLVE_DEPENDENCY(${network_model_path} ARCHIVE "models_archives/${archive}" TARGET_PATH "${MODELS_PATH}/${network}") diff --git a/cmake/developer_package/models.cmake b/cmake/developer_package/models.cmake index 9c6f3fa7fc02a8..597736e2fb77a7 100644 --- a/cmake/developer_package/models.cmake +++ b/cmake/developer_package/models.cmake @@ -2,14 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 # -if(ENABLE_DATA) - find_package(Git REQUIRED) -endif() - set(MODELS_LST "") set(MODELS_LST_TO_FETCH "") function (add_models_repo add_to_fetcher model_name) + message(WARNING "DEPRECATED: 'add_models_repo' must not be used") + list(LENGTH ARGV add_models_args) if (add_models_args EQUAL 3) list(GET ARGV 2 branch_name) @@ -28,6 +26,8 @@ function (add_models_repo add_to_fetcher model_name) endfunction() function(add_lfs_repo name prefix url tag) + message(WARNING "DEPRECATED: 'add_lfs_repo' must not be used") + if(TARGET ${name}) return() endif() @@ -44,6 +44,8 @@ function(add_lfs_repo name prefix url tag) INSTALL_COMMAND "" LOG_DOWNLOAD ON) + find_package(Git REQUIRED) + execute_process( COMMAND ${GIT_EXECUTABLE} lfs install --local --force WORKING_DIRECTORY ${prefix}/src/${name} @@ -59,6 +61,8 @@ function(add_lfs_repo name prefix url tag) endfunction() function (fetch_models_and_validation_set) + message(WARNING "DEPRECATED: 'fetch_models_and_validation_set' must not be used") + foreach(loop_var ${MODELS_LST_TO_FETCH}) string(REPLACE ":" ";" MODEL_CONFIG_LST ${loop_var}) diff --git a/cmake/features.cmake b/cmake/features.cmake index 9fdee1f1f8277b..5dca5b7b21bef1 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -107,8 +107,6 @@ ie_dependent_option (GAPI_TEST_PERF "if GAPI unit tests should examine performan ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS" OFF) -ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF) - ie_option (ENABLE_SAMPLES "console samples are part of OpenVINO Runtime package" ON) set(OPENVINO_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to include into OpenVINO build") diff --git a/install_build_dependencies.sh b/install_build_dependencies.sh index 21faba35e5aa2b..bbcbb34d476ac3 100755 --- a/install_build_dependencies.sh +++ b/install_build_dependencies.sh @@ -106,7 +106,6 @@ elif [ -f /etc/redhat-release ] || grep -q "rhel" /etc/os-release ; then make \ `# to determine openvino version via git` \ git \ - git-lfs \ `# to build and check pip packages` \ patchelf \ fdupes \ @@ -145,7 +144,6 @@ elif [ -f /etc/os-release ] && grep -q "SUSE" /etc/os-release ; then make \ `# to determine openvino version via git` \ git \ - git-lfs \ `# to build and check pip packages` \ patchelf \ fdupes \ diff --git a/src/bindings/c/tests/test_model_repo.cpp b/src/bindings/c/tests/test_model_repo.cpp index 1a7e64975a63bb..c221df9e3f8fe9 100644 --- a/src/bindings/c/tests/test_model_repo.cpp +++ b/src/bindings/c/tests/test_model_repo.cpp @@ -7,6 +7,18 @@ #include namespace TestDataHelpers { + +const std::string model_bin_name = "test_model.bin"; +const std::string model_xml_name = "test_model.xml"; +const std::string model_exported_name = "test_exported_model.blob"; + +void generate_test_model() { + ov::pass::Manager manager; + manager.register_pass(model_xml_name, model_bin_name); + auto function = ngraph::builder::subgraph::makeConvPoolReluNoReshapes({1, 3, 227, 227}); + manager.run_passes(function); +} + std::string generate_test_xml_file() { // Create the file std::string plugin_xml = "plugin_test.xml"; diff --git a/src/bindings/c/tests/test_model_repo.hpp b/src/bindings/c/tests/test_model_repo.hpp index b9a595c9577e24..b6f016f27ed3c2 100644 --- a/src/bindings/c/tests/test_model_repo.hpp +++ b/src/bindings/c/tests/test_model_repo.hpp @@ -15,16 +15,11 @@ namespace TestDataHelpers { -static const std::string model_bin_name = "test_model.bin"; -static const std::string model_xml_name = "test_model.xml"; -static const std::string model_exported_name = "test_exported_model.blob"; - -inline void generate_test_model() { - ov::pass::Manager manager; - manager.register_pass(model_xml_name, model_bin_name); - auto function = ngraph::builder::subgraph::makeConvPoolReluNoReshapes({1, 3, 227, 227}); - manager.run_passes(function); -} +extern const std::string model_bin_name; +extern const std::string model_xml_name; +extern const std::string model_exported_name; + +void generate_test_model(); inline std::string get_model_xml_file_name() { return model_xml_name; diff --git a/src/plugins/intel_gna/tests/deprecated/helpers/CMakeLists.txt b/src/plugins/intel_gna/tests/deprecated/helpers/CMakeLists.txt index 845af496642ce1..3423cf8f90ac86 100644 --- a/src/plugins/intel_gna/tests/deprecated/helpers/CMakeLists.txt +++ b/src/plugins/intel_gna/tests/deprecated/helpers/CMakeLists.txt @@ -13,9 +13,6 @@ file (GLOB HELPERS_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp ) -## Enable Models multiple search paths -message("configuring file: ${CMAKE_CURRENT_BINARY_DIR}/test_model_repo.h") - function(add_helpers target_name) add_library(${target_name} STATIC ${HELPERS_SRC}) @@ -37,8 +34,3 @@ add_helpers(${TARGET_NAME}_s USE_STATIC_IE) target_link_libraries(${TARGET_NAME}_s PUBLIC common_test_utils_s PRIVATE inference_engine_legacy_s) - -if (ENABLE_DATA) - add_dependencies(${TARGET_NAME} data) - add_dependencies(${TARGET_NAME}_s data) -endif() diff --git a/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.cpp b/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.cpp deleted file mode 100644 index fe183cae6e7a88..00000000000000 --- a/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -// -// Created by user on 19.10.18. -// - -#include "helpers/test_model_repo.hpp" -#include "test_model_path.hpp" - -#ifndef _WIN32 -# include -# include -#else -# include -#endif - -#include -#include -#include -#include -#include -#include - -#ifndef _WIN32 -static std::string getDirname(std::string filePath) { - std::vector input(filePath.begin(), filePath.end()); - input.push_back(0); - return dirname(&*input.begin()); -} -#else -static std::string getDirname(std::string filePath) { - char dirname[_MAX_DIR] = {}; - char drive[_MAX_DRIVE] = {}; - _splitpath(filePath.c_str(), drive, dirname, nullptr, nullptr); // preserve drive letter if possible - return std::string(drive) + dirname; -} -#endif - -static std::string get_models_path() { - const char* models_path = TestDataHelpers::get_model_path_non_fatal(); - - if (nullptr == models_path) { - ::testing::AssertionFailure() << "MODELS_PATH not defined"; - } - - return std::string(models_path); -} - -static bool exist(const std::string& name) { - std::ifstream file(name); - if(!file) // If the file was not found, then file is 0, i.e. !file=1 or true. - return false; // The file was not found. - else // If the file was found, then file is non-0. - return true; // The file was found. -} - -static std::vector getModelsDirs() { - auto repo_list = get_model_repo(); - int last_delimiter = 0; - std::vector folders; - for(;;) { - auto folderDelimiter = repo_list.find(':', last_delimiter); - if (folderDelimiter == std::string::npos) { - break; - } - auto nextDelimiter = repo_list.find(';', last_delimiter); - folders.push_back(repo_list.substr(last_delimiter, folderDelimiter - last_delimiter)); - - if (nextDelimiter == std::string::npos) { - break; - } - - last_delimiter = nextDelimiter + 1; - } - return folders; -} - -ModelsPath::operator std::string() const { - std::vector absModelsPath; - for (auto & path : getModelsDirs()) { - std::string b = get_models_path(); - const auto absPath = get_models_path() + kPathSeparator + path + _rel_path.str(); - absModelsPath.push_back(absPath); - if (exist(absPath)) { - return absPath; - } - //checking models for precision encoded in folder name - auto dirname = getDirname(absPath); - std::vector> stdprecisions = { - {"_fp32", "FP32"}, - {"_q78", "_Q78"}, - {"_fp16", "FP16"}, - {"_i16", "I16"} - }; - - if (dirname.size() == absPath.size()) - continue; - - auto filename = absPath.substr(dirname.size() + 1); - - for (auto &precision : stdprecisions) { - auto havePrecision = filename.find(precision.first); - if (havePrecision == std::string::npos) continue; - - auto newName = filename.replace(havePrecision, precision.first.size(), ""); - newName = dirname + kPathSeparator + precision.second + kPathSeparator + newName; - - if (exist(newName)) { - return newName; - } - } - } - - // checking dirname - auto getModelsDirname = [](std::string path) -> std::string { - std::string dir = getDirname(path); - - struct stat sb; - if (stat(dir.c_str(), &sb) != 0 || !S_ISDIR(sb.st_mode)) { - return ""; - } - return dir; - }; - - for (auto & path : absModelsPath) { - std::string publicDir = getModelsDirname(path); - - if (!publicDir.empty()) { - return path; - } - } - std::stringstream errorMsg; - errorMsg<< "path to model invalid, models found at: \n"; - - for (auto & path : absModelsPath) { - errorMsg << path <<"\n"; - } - errorMsg << "also searched by parent directory names: \n"; - for (auto & path : absModelsPath) { - errorMsg << getDirname(path) << "\n"; - } - - std::cout << errorMsg.str(); - ::testing::AssertionFailure() << errorMsg.str(); - - // doesn't matter what to return here - return ""; -} diff --git a/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.hpp b/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.hpp deleted file mode 100644 index 08eac4268447c3..00000000000000 --- a/src/plugins/intel_gna/tests/deprecated/helpers/test_model_path.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -static const char kPathSeparator = -#if defined _WIN32 || defined __CYGWIN__ - '\\'; -#else - '/'; -#endif - -class ModelsPath { - std::stringstream _rel_path; - mutable std::string _abs_path; - - public: - - ModelsPath() = default; - - ModelsPath(const ModelsPath & that) { - _rel_path << that._rel_path.str(); - } - - template - ModelsPath operator + (const T & relative_path) const { - ModelsPath newPath(*this); - newPath += relative_path; - return newPath; - } - - template - ModelsPath & operator += (const T & relative_path) { - _rel_path << relative_path; - return *this; - } - - template - ModelsPath & operator << (const T & serializable) { - _rel_path << serializable; - return *this; - } - - std::string str() const { - return this->operator std::string(); - } - - const char * c_str() const { - _abs_path = this->operator std::string (); - return _abs_path.c_str(); - } - - operator std::string() const; -}; - -inline std::ostream & operator << (std::ostream &os, const ModelsPath & path) { - os << path.str(); - return os; -} diff --git a/src/plugins/intel_gna/tests/deprecated/helpers/tests_common.hpp b/src/plugins/intel_gna/tests/deprecated/helpers/tests_common.hpp index 7f06a55f0d49cb..f164fc1e8ca361 100644 --- a/src/plugins/intel_gna/tests/deprecated/helpers/tests_common.hpp +++ b/src/plugins/intel_gna/tests/deprecated/helpers/tests_common.hpp @@ -22,7 +22,6 @@ #include #include "helpers/test_model_repo.hpp" -#include "test_model_path.hpp" #include #include diff --git a/src/plugins/intel_gna/tests/functional/CMakeLists.txt b/src/plugins/intel_gna/tests/functional/CMakeLists.txt index bef471c7b9b1e4..92a86566b869d4 100644 --- a/src/plugins/intel_gna/tests/functional/CMakeLists.txt +++ b/src/plugins/intel_gna/tests/functional/CMakeLists.txt @@ -25,7 +25,3 @@ addIeTargetTest( target_compile_definitions(${TARGET_NAME} PUBLIC ${ARGV} GNA_DATA_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/data\") - -if (ENABLE_DATA) - add_dependencies(${TARGET_NAME} data) -endif() \ No newline at end of file diff --git a/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.cpp b/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.cpp index 0fbe800dc11c26..8f133d806fe495 100644 --- a/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.cpp +++ b/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.cpp @@ -4,14 +4,14 @@ #include "test_model_repo.hpp" -std::string get_model_repo() { - return "models:"; -}; - -const char* TestDataHelpers::get_model_path_non_fatal() noexcept { - return TestDataHelpers::get_model_path_non_fatal_default(); -} - std::string TestDataHelpers::get_data_path() { - return TestDataHelpers::get_data_path_default(); + if (const auto env_var = std::getenv("GNA_DATA_PATH")) { + return env_var; + } + +#ifdef GNA_DATA_PATH + return GNA_DATA_PATH; +#else + return nullptr; +#endif } diff --git a/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.hpp b/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.hpp index 76994e4b6efa0d..fcbfb6e1c7b7e0 100644 --- a/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.hpp +++ b/src/plugins/intel_gna/tests/functional/helpers/test_model_repo.hpp @@ -5,35 +5,8 @@ #pragma once #include -std::string get_model_repo(); - namespace TestDataHelpers { -const char* get_model_path_non_fatal() noexcept; - std::string get_data_path(); -inline const char* get_model_path_non_fatal_default() noexcept { - if (const auto env_var = std::getenv("MODELS_PATH")) { - return env_var; - } - -#ifdef MODELS_PATH - return MODELS_PATH; -#else - return nullptr; -#endif -}; - -inline std::string get_data_path_default() { - if (const auto env_var = std::getenv("GNA_DATA_PATH")) { - return env_var; - } - -#ifdef GNA_DATA_PATH - return GNA_DATA_PATH; -#else - return nullptr; -#endif -} } // namespace TestDataHelpers From b8942b6dd67d468a70644d281d04a09a1fb40d14 Mon Sep 17 00:00:00 2001 From: yanlan song Date: Mon, 18 Sep 2023 14:13:38 +0800 Subject: [PATCH 02/12] Ensure so is there for lifecycle (#19510) * ensure so is there for lifecycle Signed-off-by: fishbell * batch plugin + batch not triggered case Signed-off-by: fishbell * clang Signed-off-by: fishbell * fix settensor failure Signed-off-by: fishbell * fix model info mismatch when load with 1.0 API with ppp info Signed-off-by: fishbell * remove unncessary ppp code Signed-off-by: fishbell * Update src/plugins/auto_batch/src/compiled_model.cpp Co-authored-by: Ilya Churaev * enable the meta holder cases Signed-off-by: fishbell --------- Signed-off-by: fishbell Co-authored-by: Ilya Churaev --- src/plugins/auto/src/infer_request.cpp | 12 +- .../auto_batch/src/async_infer_request.cpp | 115 ++++++++++++++---- .../auto_batch/src/async_infer_request.hpp | 5 + src/plugins/auto_batch/src/compiled_model.cpp | 35 +++--- src/plugins/auto_batch/src/compiled_model.hpp | 4 + .../auto_batch/src/sync_infer_request.cpp | 7 +- .../auto_batch/src/sync_infer_request.hpp | 6 +- .../skip_tests_config.cpp | 5 - 8 files changed, 135 insertions(+), 54 deletions(-) diff --git a/src/plugins/auto/src/infer_request.cpp b/src/plugins/auto/src/infer_request.cpp index 62aa40ffba30f4..4731d9cf1c22f8 100644 --- a/src/plugins/auto/src/infer_request.cpp +++ b/src/plugins/auto/src/infer_request.cpp @@ -56,10 +56,18 @@ ov::auto_plugin::InferRequest::InferRequest(const std::shared_ptrget_tensor(input)); + auto tensor = m_shared_request->get_tensor(input); + if (!tensor._so) { + tensor._so = m_shared_request._so; + } + ov::ISyncInferRequest::set_tensor(input, tensor); } for (const auto& output : get_outputs()) { - ov::ISyncInferRequest::set_tensor(output, m_shared_request->get_tensor(output)); + auto tensor = m_shared_request->get_tensor(output); + if (!tensor._so) { + tensor._so = m_shared_request._so; + } + ov::ISyncInferRequest::set_tensor(output, tensor); } } } diff --git a/src/plugins/auto_batch/src/async_infer_request.cpp b/src/plugins/auto_batch/src/async_infer_request.cpp index 925c86d42272ac..bd4983ff0ab106 100644 --- a/src/plugins/auto_batch/src/async_infer_request.cpp +++ b/src/plugins/auto_batch/src/async_infer_request.cpp @@ -15,35 +15,96 @@ AsyncInferRequest::AsyncInferRequest(const std::shared_ptr& re : ov::IAsyncInferRequest(request, nullptr, callback_executor), m_sync_request(request), m_request_without_batch(request_without_batch) { - // this executor starts the inference while the task (checking the result) is passed to the next stage - struct ThisRequestExecutor : public ov::threading::ITaskExecutor { - explicit ThisRequestExecutor(AsyncInferRequest* _this_) : _this{_this_} {} - void run(ov::threading::Task task) override { - auto workerInferRequest = _this->m_sync_request->m_batched_request_wrapper; - std::pair t; - t.first = _this; - t.second = std::move(task); - workerInferRequest->_tasks.push(t); - // it is ok to call size() here as the queue only grows (and the bulk removal happens under the mutex) - const int sz = static_cast(workerInferRequest->_tasks.size()); - if (sz == workerInferRequest->_batch_size) { - workerInferRequest->_cond.notify_one(); + if (m_sync_request && m_sync_request->get_batch_size() == 0) { + // batch not applicable, just a wrapper to hardware infer request + // share the tensors with hardware infer request + for (const auto& input : get_inputs()) { + auto tensor = m_request_without_batch->get_tensor(input); + if (!tensor._so) { + tensor._so = m_request_without_batch._so; } + set_tensor(input, tensor); + } + for (const auto& output : get_outputs()) { + auto tensor = m_request_without_batch->get_tensor(output); + if (!tensor._so) { + tensor._so = m_request_without_batch._so; + } + set_tensor(output, tensor); + } + struct RequestExecutor : ov::threading::ITaskExecutor { + explicit RequestExecutor(const ov::SoPtr& infer_request) + : m_inferrequest(infer_request) { + m_inferrequest->set_callback([this](std::exception_ptr exceptionPtr) mutable { + m_exceptionptr = std::move(exceptionPtr); + auto capturedTask = std::move(m_task); + capturedTask(); + }); + } + void run(ov::threading::Task task) override { + m_task = std::move(task); + m_inferrequest->start_async(); + }; + const ov::SoPtr& m_inferrequest; + std::exception_ptr m_exceptionptr; + ov::threading::Task m_task; }; - AsyncInferRequest* _this = nullptr; - }; - m_pipeline = {{/*TaskExecutor*/ std::make_shared(this), /*task*/ [this] { - if (this->m_sync_request->m_exception_ptr) // if the exception happened in the batch1 fallback - std::rethrow_exception(this->m_sync_request->m_exception_ptr); - auto batchReq = this->m_sync_request->m_batched_request_wrapper; - if (batchReq->_exception_ptr) // when the batchN execution failed - std::rethrow_exception(batchReq->_exception_ptr); - // in the case of non-batched execution the tensors were set explicitly - if (SyncInferRequest::eExecutionFlavor::BATCH_EXECUTED == - this->m_sync_request->m_batched_request_status) { - this->m_sync_request->copy_outputs_if_needed(); - } - }}}; + auto requestExecutor = std::make_shared(m_request_without_batch); + m_pipeline.emplace_back(requestExecutor, [requestExecutor] { + if (nullptr != requestExecutor->m_exceptionptr) { + std::rethrow_exception(requestExecutor->m_exceptionptr); + } + }); + } else { + // batch size > 1, try infer with batched request + // this executor starts the inference while the task (checking the result) is passed to the next stage + struct ThisRequestExecutor : public ov::threading::ITaskExecutor { + explicit ThisRequestExecutor(AsyncInferRequest* _this_) : _this{_this_} {} + void run(ov::threading::Task task) override { + auto workerInferRequest = _this->m_sync_request->m_batched_request_wrapper; + std::pair t; + t.first = _this; + t.second = std::move(task); + workerInferRequest->_tasks.push(t); + // it is ok to call size() here as the queue only grows (and the bulk removal happens under the mutex) + const int sz = static_cast(workerInferRequest->_tasks.size()); + if (sz == workerInferRequest->_batch_size) { + workerInferRequest->_cond.notify_one(); + } + }; + AsyncInferRequest* _this = nullptr; + }; + m_pipeline = { + {/*TaskExecutor*/ std::make_shared(this), /*task*/ [this] { + if (this->m_sync_request->m_exception_ptr) // if the exception happened in the batch1 fallback + std::rethrow_exception(this->m_sync_request->m_exception_ptr); + auto batchReq = this->m_sync_request->m_batched_request_wrapper; + if (batchReq->_exception_ptr) // when the batchN execution failed + std::rethrow_exception(batchReq->_exception_ptr); + // in the case of non-batched execution the tensors were set explicitly + if (SyncInferRequest::eExecutionFlavor::BATCH_EXECUTED == + this->m_sync_request->m_batched_request_status) { + this->m_sync_request->copy_outputs_if_needed(); + } + }}}; + } +} + +void AsyncInferRequest::set_tensor(const ov::Output& port, const ov::SoPtr& tensor) { + check_state(); + if (m_sync_request && m_sync_request->get_batch_size() == 0) { + m_request_without_batch->set_tensor(port, tensor); + } + ov::IAsyncInferRequest::set_tensor(port, tensor); +} + +void AsyncInferRequest::set_tensors(const ov::Output& port, + const std::vector>& tensors) { + check_state(); + if (m_sync_request && m_sync_request->get_batch_size() == 0) { + m_request_without_batch->set_tensors(port, tensors); + } + ov::IAsyncInferRequest::set_tensors(port, tensors); } std::vector AsyncInferRequest::get_profiling_info() const { diff --git a/src/plugins/auto_batch/src/async_infer_request.hpp b/src/plugins/auto_batch/src/async_infer_request.hpp index da2ff28f8b198b..93f13ca5b3aa12 100644 --- a/src/plugins/auto_batch/src/async_infer_request.hpp +++ b/src/plugins/auto_batch/src/async_infer_request.hpp @@ -26,6 +26,11 @@ class AsyncInferRequest : public ov::IAsyncInferRequest { std::shared_ptr m_sync_request; + void set_tensor(const ov::Output& port, const ov::SoPtr& tensor) override; + + void set_tensors(const ov::Output& port, + const std::vector>& tensors) override; + ov::SoPtr m_request_without_batch; }; } // namespace autobatch_plugin diff --git a/src/plugins/auto_batch/src/compiled_model.cpp b/src/plugins/auto_batch/src/compiled_model.cpp index 0bcb0b17d30fdd..8c44f48356a29f 100644 --- a/src/plugins/auto_batch/src/compiled_model.cpp +++ b/src/plugins/auto_batch/src/compiled_model.cpp @@ -134,26 +134,19 @@ CompiledModel::GetWorkerInferRequest() const { } std::shared_ptr CompiledModel::create_infer_request() const { - if (!m_compiled_model_with_batch) { - auto res = m_compiled_model_without_batch->create_infer_request(); - for (auto& iter : res->get_inputs()) { - auto&& tensor = res->get_tensor(iter); - if (!tensor._so) - tensor._so = m_compiled_model_without_batch._so; - } - for (auto& iter : res->get_outputs()) { - auto&& tensor = res->get_tensor(iter); - if (!tensor._so) - tensor._so = m_compiled_model_without_batch._so; - } - return res; - } - - auto sync_res = create_sync_infer_request(); - ov::SoPtr infer_request_without_batch = { m_compiled_model_without_batch->create_infer_request(), m_compiled_model_without_batch._so}; + // simpler wrapper if m_compiled_model_with_batch is empty + std::shared_ptr sync_res; + if (m_compiled_model_with_batch) + sync_res = create_sync_infer_request(); + else + sync_res = std::make_shared( + std::dynamic_pointer_cast(shared_from_this()), + nullptr, + 0, + 0); return std::make_shared( std::dynamic_pointer_cast(sync_res), infer_request_without_batch, @@ -249,6 +242,14 @@ ov::Any CompiledModel::get_property(const std::string& name) const { OPENVINO_SUPPRESS_DEPRECATED_END } +const std::vector>& CompiledModel::outputs() const { + return m_compiled_model_without_batch->outputs(); +} + +const std::vector>& CompiledModel::inputs() const { + return m_compiled_model_without_batch->inputs(); +} + void CompiledModel::export_model(std::ostream& model) const { OPENVINO_NOT_IMPLEMENTED; } diff --git a/src/plugins/auto_batch/src/compiled_model.hpp b/src/plugins/auto_batch/src/compiled_model.hpp index abbae01bae307d..245c0ea36ecc15 100644 --- a/src/plugins/auto_batch/src/compiled_model.hpp +++ b/src/plugins/auto_batch/src/compiled_model.hpp @@ -54,6 +54,10 @@ class CompiledModel : public ov::ICompiledModel { virtual ~CompiledModel(); + const std::vector>& outputs() const override; + + const std::vector>& inputs() const override; + protected: std::shared_ptr create_sync_infer_request() const override; static unsigned int ParseTimeoutValue(const std::string&); diff --git a/src/plugins/auto_batch/src/sync_infer_request.cpp b/src/plugins/auto_batch/src/sync_infer_request.cpp index 824926c88e6393..4342ad6a55dfb9 100644 --- a/src/plugins/auto_batch/src/sync_infer_request.cpp +++ b/src/plugins/auto_batch/src/sync_infer_request.cpp @@ -41,7 +41,12 @@ SyncInferRequest::SyncInferRequest( m_batched_request_wrapper(worker_request), m_batch_id(batch_id), m_batch_size(num_batch) { - share_tensors_with_batched_req(batched_inputs, batched_outputs); + if (m_batched_request_wrapper) + share_tensors_with_batched_req(batched_inputs, batched_outputs); +} + +size_t SyncInferRequest::get_batch_size() const { + return m_batch_size; } void SyncInferRequest::share_tensors_with_batched_req(const std::set& batched_inputs, diff --git a/src/plugins/auto_batch/src/sync_infer_request.hpp b/src/plugins/auto_batch/src/sync_infer_request.hpp index f0aaba0fe2c599..01b61f538a0bd7 100644 --- a/src/plugins/auto_batch/src/sync_infer_request.hpp +++ b/src/plugins/auto_batch/src/sync_infer_request.hpp @@ -17,8 +17,8 @@ class SyncInferRequest : public ov::ISyncInferRequest { const std::shared_ptr& worker_request, int batch_id, int num_batch, - const std::set& batched_inputs, - const std::set& batched_outputs); + const std::set& batched_inputs = {}, + const std::set& batched_outputs = {}); // Batch-Device impl specific: sets the data (blobs from the device request to the batched device request) void set_tensors_to_another_request(ov::SoPtr& req); @@ -43,6 +43,8 @@ class SyncInferRequest : public ov::ISyncInferRequest { TIMEOUT_EXECUTED } m_batched_request_status = eExecutionFlavor::NOT_EXECUTED; + size_t get_batch_size() const; + protected: void copy_tensor_if_needed(const ov::SoPtr& src, ov::SoPtr& dst, const bool bInput); diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index c4a71cdddd63aa..677cc9a2c217e4 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -127,10 +127,5 @@ std::vector disabledTestPatterns() { R"(.*smoke_LPT.*ElementwiseBranchSelectionTransformation.*)", // Dynamic state unsupported for now R"(.*MemoryDynamicBatch.*)", - // Meta plugins may miss saving HW plugin so handle, thus plugin may be unloaded before all objects are deleted which leads to segfault - // Issue: 118840 - R"(.*OVHoldersTest.*AUTO.*)", - R"(.*OVHoldersTest.*MULTI.*)", - R"(.*OVHoldersTest.*BATCH.*)", }; } From 5fd16dc92e67417a0e50657c2bcbea5500b46f63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:41:41 +0400 Subject: [PATCH 03/12] Bump SimenB/github-actions-cpu-cores from 1 to 2 (#19894) Bumps [SimenB/github-actions-cpu-cores](https://github.com/simenb/github-actions-cpu-cores) from 1 to 2. - [Release notes](https://github.com/simenb/github-actions-cpu-cores/releases) - [Commits](https://github.com/simenb/github-actions-cpu-cores/compare/v1...v2) --- updated-dependencies: - dependency-name: SimenB/github-actions-cpu-cores dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/windows_conditional_compilation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 1b884811c43316..22074d4a6435f7 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -85,7 +85,7 @@ jobs: # - name: Get number of CPU cores - uses: SimenB/github-actions-cpu-cores@v1 + uses: SimenB/github-actions-cpu-cores@v2 id: cpu-cores - uses: ilammy/msvc-dev-cmd@v1 From b7dcae3ab67da2a5da499b0fc8ff601961c87031 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:42:07 +0400 Subject: [PATCH 04/12] Bump actions/checkout from 3 to 4 (#19893) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/linux_conditional_compilation.yml | 4 ++-- .github/workflows/windows_conditional_compilation.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index 8ebad71c82af8d..93ea9fb5ee2aa3 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -48,13 +48,13 @@ jobs: PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" steps: - name: Clone OpenVINO - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: 'openvino' submodules: 'true' - name: Clone test models - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: 'openvinotoolkit/testdata' path: 'testdata' diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 22074d4a6435f7..5418afff20f54a 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -56,7 +56,7 @@ jobs: runs-on: windows-latest-8-cores steps: - name: Clone OpenVINO - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: 'openvino' submodules: 'true' From 09aece638d4fb713199e5053faf3a0138cb157da Mon Sep 17 00:00:00 2001 From: Przemyslaw Wysocki Date: Mon, 18 Sep 2023 09:53:45 +0200 Subject: [PATCH 05/12] Fix typo in Good First Issue template (#19898) * Add gfi * Minor change * Fix linter * fix typo * Fix typo' --- .github/ISSUE_TEMPLATE/good_first_issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/good_first_issue.yml b/.github/ISSUE_TEMPLATE/good_first_issue.yml index c48d0ee6394b9a..658e1bb00a9739 100644 --- a/.github/ISSUE_TEMPLATE/good_first_issue.yml +++ b/.github/ISSUE_TEMPLATE/good_first_issue.yml @@ -27,7 +27,7 @@ body: - type: textarea id: example_prs attributes: - label: Exmaple Pull Requests + label: Example Pull Requests description: | Provide example Pull requests, if there are any. validations: From e9aaf9aa1be6faece796feb129ee55768ba99d72 Mon Sep 17 00:00:00 2001 From: "mei, yang" Date: Mon, 18 Sep 2023 16:39:11 +0800 Subject: [PATCH 06/12] [CPU] Fix Interpolate impl bug and add related test case (#19783) --- src/plugins/intel_cpu/src/nodes/bin_conv.cpp | 2 +- src/plugins/intel_cpu/src/nodes/interpolate.cpp | 2 +- .../functional/single_layer_tests/interpolate.cpp | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp index ab8694b6669511..f37c9a51946c0a 100644 --- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp @@ -586,8 +586,8 @@ struct jit_uni_bin_conv_kernel_f32 : public jit_uni_bin_conv_kernel, public jit_ add(reg_d_weights, jcp_.oc_block * sizeof(float)); } - depthwise_inj_idx++; post_ops_data_offset += depthwise_injectors[depthwise_inj_idx]->memoryStep(); + depthwise_inj_idx++; push(reg_oc_off); } else if (post_op.is_sum(false)) { diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp index 60a1259f43aba4..4292b85724cf94 100644 --- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp +++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp @@ -1519,8 +1519,8 @@ struct jit_uni_interpolate_kernel_f32 : public jit_uni_interpolate_kernel, publi depthwise_injectors[depthwise_inj_idx]->compute_vector_range( vmm_val.getIdx(), vmm_val.getIdx() + 1, reg_d_weights, reg_d_weights, is_broadcast); - depthwise_inj_idx++; post_ops_data_offset += depthwise_injectors[depthwise_inj_idx]->memoryStep(); + depthwise_inj_idx++; } else if (post_op.is_quantization()) { bool do_dequantization = post_op.quantization.alg == alg_kind::quantization_quantize_dequantize; bool do_rounding = do_dequantization || dst_prc == Precision::FP32 || i != p.len() - 1; diff --git a/src/plugins/intel_cpu/tests/functional/single_layer_tests/interpolate.cpp b/src/plugins/intel_cpu/tests/functional/single_layer_tests/interpolate.cpp index 7cb20b34e6667f..3256a232233566 100644 --- a/src/plugins/intel_cpu/tests/functional/single_layer_tests/interpolate.cpp +++ b/src/plugins/intel_cpu/tests/functional/single_layer_tests/interpolate.cpp @@ -462,13 +462,18 @@ const std::vector shapeParams4D_fixed_C = { }; #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) +const std::vector interpolateFusingParamsSet_fixed_C{ + fusingFakeQuantizePerChannelRelu, + fusingMultiplyPerChannel, +}; + INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLayerCPUTest, ::testing::Combine( interpolateCasesNN_Smoke, ::testing::ValuesIn(shapeParams4D_fixed_C), ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), - ::testing::Values(fusingFakeQuantizePerChannelRelu), + ::testing::ValuesIn(interpolateFusingParamsSet_fixed_C), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); @@ -478,7 +483,7 @@ INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLa ::testing::ValuesIn(shapeParams4D_fixed_C), ::testing::Values(ElementType::f32), ::testing::ValuesIn(filterCPUInfoForDevice()), - ::testing::Values(fusingFakeQuantizePerChannelRelu), + ::testing::ValuesIn(interpolateFusingParamsSet_fixed_C), ::testing::ValuesIn(filterAdditionalConfig())), InterpolateLayerCPUTest::getTestCaseName); #endif @@ -1015,5 +1020,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_InterpolateBicubicPillow_LayoutAlign_Test, Interp InterpolateLayerCPUTest::getTestCaseName); } // namespace - } // namespace CPULayerTestsDefinitions From 253ca8c746425afd9c2e570d6882f797f44c0834 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 18 Sep 2023 13:58:20 +0400 Subject: [PATCH 07/12] Fixed GPU plugin static build with oneDNN (#19811) * Fixed GPU plugin static build with oneDNN * Fixed issue with absolute paths inside installed OpenVINOConfig.cmake * Fixed absolute paths in installed OpenVINOConfig.cmake * Changed components for installation --- cmake/developer_package/plugins/plugins.cmake | 4 ++ cmake/features.cmake | 2 +- cmake/templates/OpenVINOConfig.cmake.in | 63 +++++++++++++++---- src/cmake/openvino.cmake | 15 ++--- .../intel_cpu/thirdparty/CMakeLists.txt | 8 +-- .../intel_gpu/src/graph/CMakeLists.txt | 2 +- .../src/kernel_selector/CMakeLists.txt | 14 ++++- .../intel_gpu/src/runtime/CMakeLists.txt | 2 +- .../intel_gpu/thirdparty/CMakeLists.txt | 29 ++++++--- src/plugins/template/backend/CMakeLists.txt | 2 +- src/plugins/template/src/CMakeLists.txt | 4 +- thirdparty/ocl/CMakeLists.txt | 2 +- 12 files changed, 108 insertions(+), 39 deletions(-) diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index 4138aed19f4e77..4ab78f5cfabd00 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -117,6 +117,10 @@ function(ov_add_plugin) # install rules if(NOT OV_PLUGIN_SKIP_INSTALL OR NOT BUILD_SHARED_LIBS) string(TOLOWER "${OV_PLUGIN_DEVICE_NAME}" install_component) + if(NOT BUILD_SHARED_LIBS) + # in case of static libs everything is installed to 'core' + set(install_component ${OV_CPACK_COMP_CORE}) + endif() if(OV_PLUGIN_PSEUDO_DEVICE) set(plugin_hidden HIDDEN) diff --git a/cmake/features.cmake b/cmake/features.cmake index 5dca5b7b21bef1..070d5a6ad73e9b 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -23,7 +23,7 @@ endif() ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF) -if (ANDROID OR MINGW OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR NOT BUILD_SHARED_LIBS) +if (ANDROID OR MINGW OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR (NOT BUILD_SHARED_LIBS AND ENABLE_INTEL_CPU)) # oneDNN doesn't support old compilers and android builds for now, so we'll build GPU plugin without oneDNN # also, in case of static build CPU's and GPU's oneDNNs will conflict, so we are disabling GPU's one in this case set(ENABLE_ONEDNN_FOR_GPU_DEFAULT OFF) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index 9eb1cfdd35837b..7dda80d8a312fd 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -223,6 +223,10 @@ macro(_ov_find_tbb) PATHS ${_tbb_bind_dir} NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) + if(TARGET TBBbind::tbbbind_2_5) + # To solve https://cmake.org/cmake/help/latest/policy/CMP0111.html warnings + set_property(TARGET TBBbind::tbbbind_2_5 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) + endif() unset(_tbb_bind_dir) endif() unset(install_tbbbind) @@ -343,11 +347,15 @@ endmacro() macro(_ov_find_intel_cpu_dependencies) set(_OV_ENABLE_CPU_ACL "@DNNL_USE_ACL@") if(_OV_ENABLE_CPU_ACL) - set(_ov_in_install_tree "@PACKAGE_ARM_COMPUTE_LIB_DIR@") + set(_ov_in_install_tree "@PACKAGE_OPENVINO_LIB_DIR@") if(_ov_in_install_tree) - set_and_check(ARM_COMPUTE_LIB_DIR "@PACKAGE_ARM_COMPUTE_LIB_DIR@") + set_and_check(ARM_COMPUTE_LIB_DIR "@PACKAGE_OPENVINO_LIB_DIR@") set(ACL_DIR "${CMAKE_CURRENT_LIST_DIR}") else() + if(NOT TARGET arm_compute::arm_compute) + # for case when build tree is used separately, e.g. OpenVINODeveloperPackageConfig.cmake + set_and_check(ARM_COMPUTE_LIB_DIR "@PACKAGE_CMAKE_ARCHIVE_OUTPUT_DIRECTORY@") + endif() set_and_check(ACL_DIR "@PACKAGE_FIND_ACL_PATH@") endif() @@ -363,16 +371,50 @@ macro(_ov_find_intel_gpu_dependencies) set(_OV_ENABLE_INTEL_GPU "@ENABLE_INTEL_GPU@") set(_OV_ENABLE_SYSTEM_OPENCL "@ENABLE_SYSTEM_OPENCL@") if(_OV_ENABLE_INTEL_GPU AND _OV_ENABLE_SYSTEM_OPENCL) - set(_OV_OpenCLICDLoader_FOUND "@OpenCLICDLoader_FOUND@") - if(_OV_OpenCLICDLoader_FOUND) - _ov_find_dependency(OpenCLICDLoader) - else() - _ov_find_dependency(OpenCL) - endif() - unset(_OV_OpenCLICDLoader_FOUND) + _ov_find_dependency(OpenCL) endif() unset(_OV_ENABLE_INTEL_GPU) unset(_OV_ENABLE_SYSTEM_OPENCL) + + set(_OV_ENABLE_ONEDNN_FOR_GPU "@ENABLE_ONEDNN_FOR_GPU@") + if(_OV_ENABLE_ONEDNN_FOR_GPU AND NOT TARGET onednn_gpu_tgt) + set(_OV_DNNL_GPU_LIBRARY_NAME "@DNNL_GPU_LIBRARY_NAME@") + + set(_ov_in_install_tree "@PACKAGE_OPENVINO_LIB_DIR@") + if(_ov_in_install_tree) + set(onednn_gpu_lib "${CMAKE_STATIC_LIBRARY_PREFIX}${_OV_DNNL_GPU_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set_and_check(onednn_gpu_lib_root "@PACKAGE_OPENVINO_LIB_DIR@") + if(WIN32) + if(OV_GENERATOR_MULTI_CONFIG) + set(extra_args PATH_SUFFIXES ${CMAKE_CONFIGURATION_TYPES}) + else() + set(extra_args PATH_SUFFIXES ${CMAKE_BUILD_TYPE}) + endif() + endif() + + find_library(onednn_gpu_lib_path + NAMES ${_OV_DNNL_GPU_LIBRARY_NAME} + PATHS ${onednn_gpu_lib_root} + ${extra_args}) + + if(NOT onednn_gpu_lib_path) + message(FATAL_ERROR "Internal error: failed to find '${_OV_DNNL_GPU_LIBRARY_NAME}' in '${onednn_gpu_lib_root}'") + endif() + + unset(extra_args) + unset(onednn_gpu_lib) + else() + set_and_check(onednn_gpu_lib_path "@PACKAGE_ONEDNN_GPU_LIB_PATH@") + endif() + + set_target_properties(openvino::onednn_gpu_tgt PROPERTIES + INTERFACE_LINK_LIBRARIES "${onednn_gpu_lib_path}") + + unset(onednn_gpu_lib_path) + unset(_ov_in_install_tree) + unset(_OV_DNNL_GPU_LIBRARY_NAME) + endif() + unset(_OV_ENABLE_ONEDNN_FOR_GPU) endmacro() macro(_ov_find_intel_gna_dependencies) @@ -455,6 +497,7 @@ set(_OV_ENABLE_OPENVINO_BUILD_SHARED "@BUILD_SHARED_LIBS@") if(NOT TARGET openvino) set(_ov_as_external_package ON) + include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake") endif() if(NOT _OV_ENABLE_OPENVINO_BUILD_SHARED) @@ -487,8 +530,6 @@ set(_ov_imported_libs openvino::runtime openvino::runtime::c openvino::frontend::pytorch openvino::frontend::tensorflow_lite) if(_ov_as_external_package) - include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake") - foreach(target IN LISTS _ov_imported_libs) if(TARGET ${target}) get_target_property(imported_configs ${target} IMPORTED_CONFIGURATIONS) diff --git a/src/cmake/openvino.cmake b/src/cmake/openvino.cmake index 14eb6515d27e06..302c263b024e7e 100644 --- a/src/cmake/openvino.cmake +++ b/src/cmake/openvino.cmake @@ -157,9 +157,12 @@ if(ENABLE_INTEL_GNA) list(APPEND PATH_VARS "GNA_PATH") endif() if(DNNL_USE_ACL) - list(APPEND BUILD_PATH_VARS "FIND_ACL_PATH") + list(APPEND BUILD_PATH_VARS "FIND_ACL_PATH;CMAKE_ARCHIVE_OUTPUT_DIRECTORY") set(FIND_ACL_PATH "${intel_cpu_thirdparty_SOURCE_DIR}") endif() +if(ENABLE_ONEDNN_FOR_GPU) + list(APPEND BUILD_PATH_VARS "ONEDNN_GPU_LIB_PATH") +endif() set(PUBLIC_HEADERS_DIR "${OpenVINO_SOURCE_DIR}/src/inference/include") set(IE_INCLUDE_DIR "${PUBLIC_HEADERS_DIR}/ie") @@ -177,12 +180,10 @@ configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOCo # install tree -if(DNNL_USE_ACL) - list(APPEND INSTALL_PATH_VARS "ARM_COMPUTE_LIB_DIR") - # remove generator expression at the end, because searching in Release / Debug will be - # done by ACLConfig.cmake itself - string(REPLACE "$" "" ARM_COMPUTE_LIB_DIR "${OV_CPACK_LIBRARYDIR}") -endif() +list(APPEND INSTALL_PATH_VARS "OPENVINO_LIB_DIR") +# remove generator expression at the end, because searching in Release / Debug +# will be done by inside OpenVINOConfig.cmak / ACLConfig.cmake +string(REPLACE "$" "" OPENVINO_LIB_DIR "${OV_CPACK_LIBRARYDIR}") set(IE_INCLUDE_DIR "${OV_CPACK_INCLUDEDIR}/ie") set(IE_TBB_DIR "${IE_TBB_DIR_INSTALL}") diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt index 29c298acb109fd..4c17e2e32373ec 100644 --- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt @@ -117,7 +117,7 @@ function(ov_add_onednn) add_subdirectory(onednn EXCLUDE_FROM_ALL) # install static libraries - ov_install_static_lib(dnnl cpu) + ov_install_static_lib(dnnl ${OV_CPACK_COMP_CORE}) if(DNNL_USE_ACL AND NOT BUILD_SHARED_LIBS) # use ACLConfig.cmake in OpenVINOConfig.cmake in case of static build @@ -125,16 +125,16 @@ function(ov_add_onednn) # but for this we need to install library files install(FILES $ DESTINATION ${OV_CPACK_ARCHIVEDIR} - COMPONENT cpu) + COMPONENT ${OV_CPACK_COMP_CORE}) install(FILES "${intel_cpu_thirdparty_SOURCE_DIR}/ACLConfig.cmake" DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR} - COMPONENT core_dev) + COMPONENT ${OV_CPACK_COMP_CORE_DEV}) endif() endfunction() if(ENABLE_MLAS_FOR_CPU) add_subdirectory(mlas) - ov_install_static_lib(mlas cpu) + ov_install_static_lib(mlas ${OV_CPACK_COMP_CORE}) endif() ov_add_onednn() diff --git a/src/plugins/intel_gpu/src/graph/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/CMakeLists.txt index 3831742ace55f6..dd3ddb87d1016e 100644 --- a/src/plugins/intel_gpu/src/graph/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/graph/CMakeLists.txt @@ -58,7 +58,7 @@ elseif((NOT ANDROID) AND (UNIX)) target_link_libraries(${TARGET_NAME} PRIVATE pthread) endif() -ov_install_static_lib(${TARGET_NAME} gpu) +ov_install_static_lib(${TARGET_NAME} ${OV_CPACK_COMP_CORE}) if(ENABLE_SSE42) ie_sse42_optimization_flags(sse4_2_flags) diff --git a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt index 4e4aa260520a06..99ebf5331ab305 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt @@ -91,8 +91,16 @@ add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/cache/cache.json ${TUNING_CACHE_PATH}/cache.json) +if(BUILD_SHARED_LIBS) + set(CACHE_JSON_INSTALL_DIR ${OV_CPACK_PLUGINSDIR}) + set(CACHE_JSON_COMPONENT gpu) +else() + set(CACHE_JSON_INSTALL_DIR ${OV_CPACK_ARCHIVEDIR}) + set(CACHE_JSON_COMPONENT ${OV_CPACK_COMP_CORE}) +endif() + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cache/cache.json - DESTINATION ${OV_CPACK_PLUGINSDIR} - COMPONENT gpu) + DESTINATION ${CACHE_JSON_INSTALL_DIR} + COMPONENT ${CACHE_JSON_COMPONENT}) -ov_install_static_lib(${TARGET_NAME} gpu) +ov_install_static_lib(${TARGET_NAME} ${OV_CPACK_COMP_CORE}) diff --git a/src/plugins/intel_gpu/src/runtime/CMakeLists.txt b/src/plugins/intel_gpu/src/runtime/CMakeLists.txt index 47c9139a4f9f8b..f1de561105c0ca 100644 --- a/src/plugins/intel_gpu/src/runtime/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/runtime/CMakeLists.txt @@ -64,4 +64,4 @@ elseif((NOT ANDROID) AND (UNIX)) target_link_libraries(${TARGET_NAME} PRIVATE pthread) endif() -ov_install_static_lib(${TARGET_NAME} gpu) +ov_install_static_lib(${TARGET_NAME} ${OV_CPACK_COMP_CORE}) diff --git a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt index 1d71dc6e2a2a17..4fdbbc39f3d08f 100644 --- a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt @@ -9,11 +9,12 @@ if(ENABLE_ONEDNN_FOR_GPU) function(build_onednn_gpu) include(ExternalProject) - set(ONEDNN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_build/") - set(ONEDNN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_install/") + set(ONEDNN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_build") + set(ONEDNN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_install" CACHE PATH "Installation path for oneDNN GPU library") set(ONEDNN_PREFIX_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_root") set(ONEDNN_ENABLED_PRIMITIVES "CONCAT;CONVOLUTION;DECONVOLUTION;INNER_PRODUCT;MATMUL;REORDER;POOLING;REDUCTION") set(ONEDNN_ENABLED_ISA "XEHP;XEHPG;XEHPC") + set(DNNL_GPU_LIBRARY_NAME "openvino_onednn_gpu" CACHE STRING "Name of oneDNN library for Intel GPU Plugin") if(X86_64) set(ONEDNN_TARGET_ARCH "X64" CACHE STRING "" FORCE) @@ -79,6 +80,9 @@ if(ENABLE_ONEDNN_FOR_GPU) list(APPEND cmake_extra_args "-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIR}") endif() + set(onednn_gpu_lib "${CMAKE_STATIC_LIBRARY_PREFIX}${DNNL_GPU_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(ONEDNN_GPU_LIB_PATH ${ONEDNN_INSTALL_DIR}/lib/${onednn_gpu_lib} CACHE FILEPATH "Path to oneDNN GPU library") + ExternalProject_Add(onednn_gpu_build # Directory Options: PREFIX "${ONEDNN_PREFIX_DIR}" @@ -99,7 +103,7 @@ if(ENABLE_ONEDNN_FOR_GPU) "-DDNNL_TARGET_ARCH=${ONEDNN_TARGET_ARCH}" "-DDNNL_CPU_RUNTIME=NONE" "-DDNNL_GPU_RUNTIME=OCL" - "-DDNNL_LIBRARY_NAME=openvino_onednn_gpu" + "-DDNNL_LIBRARY_NAME=${DNNL_GPU_LIBRARY_NAME}" "-DCMAKE_INSTALL_PREFIX=${ONEDNN_INSTALL_DIR}" "-DDNNL_ENABLE_CONCURRENT_EXEC=ON" "-DDNNL_ENABLE_PRIMITIVE_CACHE=OFF" @@ -124,18 +128,29 @@ if(ENABLE_ONEDNN_FOR_GPU) # Thus we pass it via CMAKE_CACHE_ARGS "-DDNNL_ENABLE_PRIMITIVE:STRING=${ONEDNN_ENABLED_PRIMITIVES}" "-DDNNL_ENABLE_PRIMITIVE_GPU_ISA:STRING=${ONEDNN_ENABLED_ISA}" + # Build Step Options: + BUILD_BYPRODUCTS ${ONEDNN_GPU_LIB_PATH} # Target Options: EXCLUDE_FROM_ALL ON ) + add_library(onednn_gpu_tgt INTERFACE) set_target_properties(onednn_gpu_tgt PROPERTIES - INTERFACE_LINK_DIRECTORIES "${ONEDNN_INSTALL_DIR}/lib" - INTERFACE_LINK_LIBRARIES "openvino_onednn_gpu" - INTERFACE_INCLUDE_DIRECTORIES "${ONEDNN_INSTALL_DIR}/include" + INTERFACE_LINK_LIBRARIES $ + INTERFACE_INCLUDE_DIRECTORIES $ INTERFACE_COMPILE_DEFINITIONS ENABLE_ONEDNN_FOR_GPU ) add_dependencies(onednn_gpu_tgt onednn_gpu_build) - # TODO: install onednn_gpu in static builds + + if(NOT BUILD_SHARED_LIBS) + ov_install_static_lib(onednn_gpu_tgt ${OV_CPACK_COMP_CORE}) + + # we need to install library explicitly and set_target_properties in OpenVINOConfig.cmake for 'onednn_gpu_tgt' + # to point to installation location of this file + install(FILES "${ONEDNN_GPU_LIB_PATH}" + DESTINATION ${OV_CPACK_ARCHIVEDIR} + COMPONENT ${OV_CPACK_COMP_CORE}) + endif() endfunction() build_onednn_gpu() endif() diff --git a/src/plugins/template/backend/CMakeLists.txt b/src/plugins/template/backend/CMakeLists.txt index 7b945216c95898..74e10c01863dfe 100644 --- a/src/plugins/template/backend/CMakeLists.txt +++ b/src/plugins/template/backend/CMakeLists.txt @@ -51,4 +51,4 @@ openvino_developer_export_targets(COMPONENT core TARGETS interpreter_backend) # install -ov_install_static_lib(interpreter_backend template) +ov_install_static_lib(interpreter_backend ${OV_CPACK_COMP_CORE}) diff --git a/src/plugins/template/src/CMakeLists.txt b/src/plugins/template/src/CMakeLists.txt index 2409bb10e0c152..f382f90d11b450 100644 --- a/src/plugins/template/src/CMakeLists.txt +++ b/src/plugins/template/src/CMakeLists.txt @@ -28,7 +28,7 @@ target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${TEMPLATE_PLUGIN_SOURCE_DIR}/include") -# link common Inference Engine libraries +# link common OpenVINO Runtime libraries target_link_libraries(${TARGET_NAME} PRIVATE openvino::interpreter_backend openvino::reference) @@ -42,4 +42,4 @@ endif() # [cmake:plugin] install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) + LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) diff --git a/thirdparty/ocl/CMakeLists.txt b/thirdparty/ocl/CMakeLists.txt index f31519467f3f64..0ebe3fd6d1df39 100644 --- a/thirdparty/ocl/CMakeLists.txt +++ b/thirdparty/ocl/CMakeLists.txt @@ -58,4 +58,4 @@ set(opencl_root_hints "${OpenCL_INCLUDE_DIR}" PARENT_SCOPE) # installation -ov_install_static_lib(OpenCL gpu) +ov_install_static_lib(OpenCL ${OV_CPACK_COMP_CORE}) From 49df8fa45e9d1e729b879d79f561a9f63444e416 Mon Sep 17 00:00:00 2001 From: Karol Blaszczak Date: Mon, 18 Sep 2023 12:22:54 +0200 Subject: [PATCH 08/12] [DOCS] updated archives for 2023.1 port master (#19896) (#19902) port: https://github.com/openvinotoolkit/openvino/pull/19896 --- docs/Documentation/openvino_ecosystem.md | 1 + .../deployment/local-distribution.md | 1 + docs/get_started/get_started_demos.md | 2 +- .../--installing-model-dev-tools.md | 2 +- .../install_guides/installing-openvino-apt.md | 10 ++- .../installing-openvino-brew.md | 2 +- .../installing-openvino-conda.md | 6 +- .../installing-openvino-from-archive-linux.md | 88 +++++++++---------- .../installing-openvino-from-archive-macos.md | 20 ++--- ...nstalling-openvino-from-archive-windows.md | 18 ++-- .../install_guides/installing-openvino-pip.md | 2 +- .../installing-openvino-vcpkg.md | 24 +++-- .../install_guides/installing-openvino-yum.md | 5 +- docs/snippets/export_compiled_model.cpp | 8 +- 14 files changed, 99 insertions(+), 90 deletions(-) diff --git a/docs/Documentation/openvino_ecosystem.md b/docs/Documentation/openvino_ecosystem.md index 2a1c7c9cfc8f88..733e6870eb9f30 100644 --- a/docs/Documentation/openvino_ecosystem.md +++ b/docs/Documentation/openvino_ecosystem.md @@ -27,6 +27,7 @@ More resources: * :doc:`Documentation ` * `GitHub `__ * `PyPI `__ +* `Conda Forge `__ **OpenVINO™ Training Extensions** diff --git a/docs/OV_Runtime_UG/deployment/local-distribution.md b/docs/OV_Runtime_UG/deployment/local-distribution.md index 397e10bdde6a47..7dfa3fea0f1dcf 100644 --- a/docs/OV_Runtime_UG/deployment/local-distribution.md +++ b/docs/OV_Runtime_UG/deployment/local-distribution.md @@ -137,6 +137,7 @@ OpenVINO Runtime uses frontend libraries dynamically to read models in different - ``openvino_tensorflow_lite_frontend`` is used to read the TensorFlow Lite file format. - ``openvino_onnx_frontend`` is used to read the ONNX file format. - ``openvino_paddle_frontend`` is used to read the Paddle file format. +- ``openvino_pytorch_frontend`` is used to convert PyTorch model via ``openvino.convert_model`` API. Depending on the model format types that are used in the application in `ov::Core::read_model `__, select the appropriate libraries. diff --git a/docs/get_started/get_started_demos.md b/docs/get_started/get_started_demos.md index 0ec61b0f0c3e1f..c7d940c676c8e2 100644 --- a/docs/get_started/get_started_demos.md +++ b/docs/get_started/get_started_demos.md @@ -58,7 +58,7 @@ To install OpenVINO Development Tools, follow the :doc:`instructions for C++ dev Build Samples +++++++++++++ -To build OpenVINO samples, follow the build instructions for your operating system on the :doc:`OpenVINO Samples ` page. The build will take about 5-10 minutes, depending on your system. +To build OpenVINO samples, follow the build instructions for your operating system on the :doc:`OpenVINO Samples ` page. The build will take about 1-2 minutes, depending on your system. .. _download-models: diff --git a/docs/install_guides/--installing-model-dev-tools.md b/docs/install_guides/--installing-model-dev-tools.md index 84b7d0069a0525..366034bafcac43 100644 --- a/docs/install_guides/--installing-model-dev-tools.md +++ b/docs/install_guides/--installing-model-dev-tools.md @@ -149,7 +149,7 @@ For example, to install and configure dependencies required for working with Ten Model conversion API support for TensorFlow 1.x environment has been deprecated. Use the ``tensorflow2`` parameter to install a TensorFlow 2.x environment that can convert both TensorFlow 1.x and 2.x models. If your model isn't compatible with the TensorFlow 2.x environment, use the `tensorflow` parameter to install the TensorFlow 1.x environment. The TF 1.x environment is provided only for legacy compatibility reasons. -For more details on the openvino-dev PyPI package, see `pypi.org `__ . +For more details on the openvino-dev PyPI package, see `pypi.org `__ . Step 5. Test the Installation +++++++++++++++++++++++++++++ diff --git a/docs/install_guides/installing-openvino-apt.md b/docs/install_guides/installing-openvino-apt.md index 9b4119239b9579..6dee8f9f19e2d8 100644 --- a/docs/install_guides/installing-openvino-apt.md +++ b/docs/install_guides/installing-openvino-apt.md @@ -13,7 +13,6 @@ * offers both C/C++ and Python APIs * does not offer support for GNA and NPU inference * additionally includes code samples - * is dedicated to Linux users. .. tab-set:: @@ -146,7 +145,7 @@ Step 2: Install OpenVINO Runtime Using the APT Package Manager .. code-block:: sh - sudo apt install openvino-2023.0.0 + sudo apt install openvino-2023.1.0 .. note:: @@ -188,6 +187,11 @@ For C++ and C, just run the ``build_samples.sh`` script: /usr/share/openvino/samples/c/build_samples.sh +Python samples can run as following: + +.. code-block:: sh + + python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py Uninstalling OpenVINO Runtime ####################################### @@ -214,7 +218,7 @@ To uninstall OpenVINO Runtime via APT, run the following command based on your n .. code-block:: sh - sudo apt autoremove openvino-2023.0.0 + sudo apt autoremove openvino-2023.1.0 What's Next? diff --git a/docs/install_guides/installing-openvino-brew.md b/docs/install_guides/installing-openvino-brew.md index 6a27a688b930e0..93f20e2ae26063 100644 --- a/docs/install_guides/installing-openvino-brew.md +++ b/docs/install_guides/installing-openvino-brew.md @@ -12,7 +12,7 @@ * offers both C/C++ and Python APIs * does not offer support for GNA and NPU inference - * is dedicated to macOS and Linux users. + * is dedicated to macOS (both arm64 and x86_64) and Linux (x86_64 only) users. .. tab-set:: diff --git a/docs/install_guides/installing-openvino-conda.md b/docs/install_guides/installing-openvino-conda.md index 29303de40c2afb..dd76f8b980cfe0 100644 --- a/docs/install_guides/installing-openvino-conda.md +++ b/docs/install_guides/installing-openvino-conda.md @@ -13,7 +13,7 @@ * offers both C/C++ and Python APIs * does not offer support for GNA and NPU inference - * is dedicated to users of all major OSs: Windows, Linux, macOS. + * is dedicated to users of all major OSs: Windows, Linux, macOS and x86_64 / arm64 architectures .. tab-set:: @@ -62,7 +62,7 @@ Installing OpenVINO Runtime with Anaconda Package Manager .. code-block:: sh - conda install -c conda-forge openvino=2023.0.1 + conda install -c conda-forge openvino=2023.1.0 Congratulations! You've just Installed OpenVINO! For some use cases you may still need to install additional components. Check the description below, as well as the @@ -100,7 +100,7 @@ with the proper OpenVINO version number: .. code-block:: sh - conda remove openvino=2023.0.1 + conda remove openvino=2023.1.0 What's Next? diff --git a/docs/install_guides/installing-openvino-from-archive-linux.md b/docs/install_guides/installing-openvino-from-archive-linux.md index d7cfdf8d224787..ace3fd5a424459 100644 --- a/docs/install_guides/installing-openvino-from-archive-linux.md +++ b/docs/install_guides/installing-openvino-from-archive-linux.md @@ -12,8 +12,8 @@ Note that the Archive distribution: * offers both C/C++ and Python APIs - * additionally includes code samples - * is dedicated to users of all major OSs: Windows, Linux, macOS + * additionally includes code samples + * is dedicated to users of all major OSs: Windows, Linux, macOS and x86_64 / arm64 architectures * may offer different hardware support under different operating systems (see the drop-down below for more details). @@ -119,7 +119,7 @@ Step 1: Download and Install the OpenVINO Core Components cd /Downloads -4. Download the `OpenVINO Runtime archive file for your system `_, extract the files, rename the extracted folder and move it to the desired path: +4. Download the `OpenVINO Runtime archive file for your system `_, extract the files, rename the extracted folder and move it to the desired path: .. tab-set:: @@ -132,71 +132,71 @@ Step 1: Download and Install the OpenVINO Core Components :sync: ubuntu-22 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_ubuntu22_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_ubuntu22_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_ubuntu22_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_ubuntu22_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 + .. tab-item:: Ubuntu 20.04 :sync: ubuntu-20 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_ubuntu20_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_ubuntu20_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_ubuntu20_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_ubuntu20_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 + .. tab-item:: Ubuntu 18.04 :sync: ubuntu-18 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_ubuntu18_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_ubuntu18_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_ubuntu18_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_ubuntu18_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 + .. tab-item:: RHEL 8 :sync: rhel-8 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_rhel8_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_rhel8_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_rhel8_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_rhel8_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 + .. tab-item:: CentOS 7 :sync: centos-7 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_centos7_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_centos7_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_centos7_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_centos7_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 + .. tab-item:: ARM 64-bit :sync: arm-64 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_debian9_2023.0.1.11005.fa1c41994f3_arm64.tgz -O openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_debian9_2023.0.1.11005.fa1c41994f3_arm64 /opt/intel/openvino_2023.0.1 - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_debian9_2023.1.0.12185.47b736f63ed_arm64.tgz -O openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_debian9_2023.1.0.12185.47b736f63ed_arm64 /opt/intel/openvino_2023.1.0 + .. tab-item:: ARM 32-bit :sync: arm-32 .. code-block:: sh - - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/linux/l_openvino_toolkit_debian9_2023.0.1.11005.fa1c41994f3_armhf.tgz -O openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv l_openvino_toolkit_debian9_2023.0.1.11005.fa1c41994f3_armhf /opt/intel/openvino_2023.0.1 - - + + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/linux/l_openvino_toolkit_debian9_2023.1.0.12185.47b736f63ed_armhf.tgz -O openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv l_openvino_toolkit_debian9_2023.1.0.12185.47b736f63ed_armhf /opt/intel/openvino_2023.1.0 + + 5. Install required system dependencies on Linux. To do this, OpenVINO provides a script in the extracted installation directory. Run the following command: .. code-block:: sh - cd /opt/intel/openvino_2023.0.1 + cd /opt/intel/openvino_2023.1.0 sudo -E ./install_dependencies/install_openvino_dependencies.sh 6. (Optional) Install *numpy* Python Library: @@ -205,11 +205,11 @@ Step 1: Download and Install the OpenVINO Core Components This step is required only when you decide to use Python API. - You can use the ``requirements.txt`` file from the ``/opt/intel/openvino_2023.0.1/python`` folder: + You can use the ``requirements.txt`` file from the ``/opt/intel/openvino_2023.1.0/python`` folder: .. code-block:: sh - cd /opt/intel/openvino_2023.0.1 + cd /opt/intel/openvino_2023.1.0 python3 -m pip install -r ./python/requirements.txt 7. For simplicity, it is useful to create a symbolic link as below: @@ -217,8 +217,8 @@ Step 1: Download and Install the OpenVINO Core Components .. code-block:: sh cd /opt/intel - sudo ln -s openvino_2023.0.1 openvino_2023 - + sudo ln -s openvino_2023.1.0 openvino_2023 + .. note:: If you have already installed a previous release of OpenVINO 2023, a symbolic link to the ``openvino_2023`` folder may already exist. Unlink the previous link with ``sudo unlink openvino_2023``, and then re-run the command above. diff --git a/docs/install_guides/installing-openvino-from-archive-macos.md b/docs/install_guides/installing-openvino-from-archive-macos.md index ac5150e1329138..c2d95fa7180012 100644 --- a/docs/install_guides/installing-openvino-from-archive-macos.md +++ b/docs/install_guides/installing-openvino-from-archive-macos.md @@ -60,7 +60,7 @@ Step 1: Install OpenVINO Core Components cd /Downloads -4. Download the `OpenVINO Runtime archive file for macOS `__, extract the files, rename the extracted folder and move it to the desired path: +4. Download the `OpenVINO Runtime archive file for macOS `__, extract the files, rename the extracted folder and move it to the desired path: .. tab-set:: @@ -69,18 +69,18 @@ Step 1: Install OpenVINO Core Components .. code-block:: sh - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/macos/m_openvino_toolkit_macos_10_15_2023.0.1.11005.fa1c41994f3_x86_64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv m_openvino_toolkit_macos_10_15_2023.0.1.11005.fa1c41994f3_x86_64 /opt/intel/openvino_2023.0.1 + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/macos/m_openvino_toolkit_macos_10_15_2023.1.0.12185.47b736f63ed_x86_64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv m_openvino_toolkit_macos_10_15_2023.1.0.12185.47b736f63ed_x86_64 /opt/intel/openvino_2023.1.0 .. tab-item:: ARM, 64-bit :sync: arm-64 .. code-block:: sh - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/macos/m_openvino_toolkit_macos_11_0_2023.0.1.11005.fa1c41994f3_arm64.tgz --output openvino_2023.0.1.tgz - tar -xf openvino_2023.0.1.tgz - sudo mv m_openvino_toolkit_macos_11_0_2023.0.1.11005.fa1c41994f3_arm64 /opt/intel/openvino_2023.0.1 + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/macos/m_openvino_toolkit_macos_11_0_2023.1.0.12185.47b736f63ed_arm64.tgz --output openvino_2023.1.0.tgz + tar -xf openvino_2023.1.0.tgz + sudo mv m_openvino_toolkit_macos_11_0_2023.1.0.12185.47b736f63ed_arm64 /opt/intel/openvino_2023.1.0 5. (Optional) Install *numpy* Python Library: @@ -88,18 +88,18 @@ Step 1: Install OpenVINO Core Components This step is required only when you decide to use Python API. - You can use the ``requirements.txt`` file from the ``/opt/intel/openvino_2023.0.1/python`` folder: + You can use the ``requirements.txt`` file from the ``/opt/intel/openvino_2023.1.0/python`` folder: .. code-block:: sh - cd /opt/intel/openvino_2023.0.1 + cd /opt/intel/openvino_2023.1.0 python3 -m pip install -r ./python/requirements.txt 6. For simplicity, it is useful to create a symbolic link as below: .. code-block:: sh - sudo ln -s /opt/intel/openvino_2023.0.1 /opt/intel/openvino_2023 + sudo ln -s /opt/intel/openvino_2023.1.0 /opt/intel/openvino_2023 .. note:: diff --git a/docs/install_guides/installing-openvino-from-archive-windows.md b/docs/install_guides/installing-openvino-from-archive-windows.md index 03ba2309807d5a..2193e78df60cb7 100644 --- a/docs/install_guides/installing-openvino-from-archive-windows.md +++ b/docs/install_guides/installing-openvino-from-archive-windows.md @@ -76,19 +76,19 @@ Step 1: Download and Install OpenVINO Core Components ``C:\Program Files (x86)\Intel`` is the recommended folder. You may also use a different path if desired or if you don't have administrator privileges on your computer. -2. Download the `OpenVINO Runtime archive file for Windows `__ to your local ``Downloads`` folder. +2. Download the `OpenVINO Runtime archive file for Windows `__ to your local ``Downloads`` folder. If you prefer using command-lines, run the following commands in the command prompt window you opened: .. code-block:: sh cd /Downloads - curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0.1/windows/w_openvino_toolkit_windows_2023.0.1.11005.fa1c41994f3_x86_64.zip --output openvino_2023.0.1.zip + curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.1/windows/w_openvino_toolkit_windows_2023.1.0.12185.47b736f63ed_x86_64.zip --output openvino_2023.1.0.zip .. note:: - A ``.sha256`` file is provided together with the archive file to validate your download process. To do that, download the ``.sha256`` file from the same repository and run ``CertUtil -hashfile openvino_2023.0.1.zip SHA256``. Compare the returned value in the output with what's in the ``.sha256`` file: if the values are the same, you have downloaded the correct file successfully; if not, create a Support ticket `here `__. + A ``.sha256`` file is provided together with the archive file to validate your download process. To do that, download the ``.sha256`` file from the same repository and run ``CertUtil -hashfile openvino_2023.1.0.zip SHA256``. Compare the returned value in the output with what's in the ``.sha256`` file: if the values are the same, you have downloaded the correct file successfully; if not, create a Support ticket `here `__. 3. Use your favorite tool to extract the archive file, rename the extracted folder, and move it to the ``C:\Program Files (x86)\Intel`` directory. @@ -97,9 +97,9 @@ Step 1: Download and Install OpenVINO Core Components .. code-block:: sh - tar -xf openvino_2023.0.1.zip - ren w_openvino_toolkit_windows_2023.0.0.10926.b4452d56304_x86_64 openvino_2023.0.1 - move openvino_2023.0.1 "C:\Program Files (x86)\Intel" + tar -xf openvino_2023.1.0.zip + ren w_openvino_toolkit_windows_2023.1.0.10926.b4452d56304_x86_64 openvino_2023.1.0 + move openvino_2023.1.0 "C:\Program Files (x86)\Intel" 4. (Optional) Install *numpy* Python Library: @@ -108,11 +108,11 @@ Step 1: Download and Install OpenVINO Core Components This step is required only when you decide to use Python API. - You can use the ``requirements.txt`` file from the ``C:\Program Files (x86)\Intel\openvino_2023.0.1\python`` folder: + You can use the ``requirements.txt`` file from the ``C:\Program Files (x86)\Intel\openvino_2023.1.0\python`` folder: .. code-block:: sh - cd "C:\Program Files (x86)\Intel\openvino_2023.0.1" + cd "C:\Program Files (x86)\Intel\openvino_2023.1.0" python -m pip install -r .\python\requirements.txt @@ -121,7 +121,7 @@ Step 1: Download and Install OpenVINO Core Components .. code-block:: sh cd C:\Program Files (x86)\Intel - mklink /D openvino_2023 openvino_2023.0.1 + mklink /D openvino_2023 openvino_2023.1.0 .. note:: diff --git a/docs/install_guides/installing-openvino-pip.md b/docs/install_guides/installing-openvino-pip.md index 1cd4548cdf0347..01fe7e50d21498 100644 --- a/docs/install_guides/installing-openvino-pip.md +++ b/docs/install_guides/installing-openvino-pip.md @@ -13,7 +13,7 @@ * offers the Python API only * does not offer support for GNA and NPU inference - * is dedicated to users of all major OSs: Windows, Linux, macOS + * is dedicated to users of all major OSs: Windows, Linux, macOS and x86_64 / arm64 architectures .. tab-set:: diff --git a/docs/install_guides/installing-openvino-vcpkg.md b/docs/install_guides/installing-openvino-vcpkg.md index 39694079dfb2d3..c0eba8c88943d6 100644 --- a/docs/install_guides/installing-openvino-vcpkg.md +++ b/docs/install_guides/installing-openvino-vcpkg.md @@ -12,7 +12,7 @@ * offers C/C++ API only * does not offer support for GNA and NPU inference - * is dedicated to users of all major OSs: Windows, Linux, macOS. + * is dedicated to users of all major OSs: Windows, Linux, macOS and x86_64 / arm64 architectures. .. tab-set:: @@ -48,27 +48,35 @@ Installing OpenVINO Runtime vcpkg install openvino - vcpkg also enables you to install only selected components, by specifying them in the command. + vcpkg also enables you to install only selected components, by specifying them in the command. See the list of `available features `__, for example: .. code-block:: sh - vcpkg install openvino[cpu,ir] + vcpkg install 'openvino[core,cpu,ir]' + + vcpkg also provides a way to install OpenVINO for any specific configuration you want via `triplets `, for example to install OpenVINO statically on Windows, use: + + .. code-block:: sh + + vcpkg install openvino:x64-windows-static Note that the vcpkg installation means building all packages and dependencies from source, which means the compiler stage will require additional time to complete the process. -After installation, you can use OpenVINO in your product by running: +After installation, you can use OpenVINO in your product's cmake scripts: .. code-block:: sh - find_package(OpenVINO) + find_package(OpenVINO REQUIRED) + +And running from terminal: .. code-block:: sh - cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake - -Congratulations! You've just Installed OpenVINO! For some use cases you may still + cmake -B -S -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake + +Congratulations! You've just Installed and used OpenVINO in your project! For some use cases you may still need to install additional components. Check the :doc:`list of additional configurations ` to see if your case needs any of them. diff --git a/docs/install_guides/installing-openvino-yum.md b/docs/install_guides/installing-openvino-yum.md index 1d7f6228141133..0a71adce6b3f65 100644 --- a/docs/install_guides/installing-openvino-yum.md +++ b/docs/install_guides/installing-openvino-yum.md @@ -13,7 +13,6 @@ * offers C/C++ APIs only * does not offer support for GNA and NPU inference * additionally includes code samples - * is dedicated to Linux users. .. tab-set:: @@ -115,7 +114,7 @@ Install OpenVINO Runtime .. code-block:: sh - sudo yum install openvino-2023.0.0 + sudo yum install openvino-2023.1.0 @@ -186,7 +185,7 @@ To uninstall OpenVINO Runtime via YUM, run the following command based on your n .. code-block:: sh - sudo yum autoremove openvino-2023.0.0 + sudo yum autoremove openvino-2023.1.0 diff --git a/docs/snippets/export_compiled_model.cpp b/docs/snippets/export_compiled_model.cpp index 912e752478daa9..02b83d6b5ec5b8 100644 --- a/docs/snippets/export_compiled_model.cpp +++ b/docs/snippets/export_compiled_model.cpp @@ -1,17 +1,13 @@ - +#include #include int main() { //! [export_compiled_model] ov::Core core; - -std::stringstream stream; - ov::CompiledModel model = core.compile_model("modelPath", "deviceName"); - +std::fstream stream("compiled_model.blob"); model.export_model(stream); - //! [export_compiled_model] return 0; From a4cbac3deedf8cfb80d561a3a5cb0486c53dce36 Mon Sep 17 00:00:00 2001 From: Maxim Vafin Date: Mon, 18 Sep 2023 13:40:40 +0200 Subject: [PATCH 09/12] [PT FE] Add tests for detectron2 models (#19888) * [PT FE] Add tests for detectron2 models * Fix names of tests * Apply suggestions from code review Co-authored-by: Roman Kazantsev * Create secondary requirements file --------- Co-authored-by: Roman Kazantsev --- .github/workflows/linux.yml | 1 + .../models_hub_common/utils.py | 3 +- .../torch_tests/detectron2_models | 65 +++++++++++++ .../torch_tests/detectron2_precommit | 26 ++++++ .../torch_tests/requirements.txt | 2 +- .../torch_tests/requirements_secondary.txt | 3 + .../torch_tests/test_detectron2.py | 93 +++++++++++++++++++ 7 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 tests/model_hub_tests/torch_tests/detectron2_models create mode 100644 tests/model_hub_tests/torch_tests/detectron2_precommit create mode 100644 tests/model_hub_tests/torch_tests/requirements_secondary.txt create mode 100644 tests/model_hub_tests/torch_tests/test_detectron2.py diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 55111be2453ee6..486cc879ec02d0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -912,6 +912,7 @@ jobs: - name: PyTorch Models Tests run: | python3 -m pip install -r ${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}/torch_tests/requirements.txt + python3 -m pip install -r ${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}/torch_tests/requirements_secondary.txt export PYTHONPATH=${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}:$PYTHONPATH python3 -m pytest ${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}/torch_tests/ -m ${{ env.TYPE }} --html=${{ env.INSTALL_TEST_DIR }}/TEST-torch_model_tests.html --self-contained-html env: diff --git a/tests/model_hub_tests/models_hub_common/utils.py b/tests/model_hub_tests/models_hub_common/utils.py index efb4bd8a64c2e9..b5699a80e62b43 100644 --- a/tests/model_hub_tests/models_hub_common/utils.py +++ b/tests/model_hub_tests/models_hub_common/utils.py @@ -32,7 +32,8 @@ def compare_two_tensors(ov_res, fw_res, eps): is_ok = True if not np.allclose(ov_res, fw_res, atol=eps, rtol=eps, equal_nan=True): is_ok = False - print("Max diff is {}".format(np.array(abs(ov_res - fw_res)).max())) + max_diff = np.abs(ov_res.astype(np.float32) - fw_res.astype(np.float32)).max() + print("Max diff is {}".format(max_diff)) else: print("Accuracy validation successful!\n") print("absolute eps: {}, relative eps: {}".format(eps, eps)) diff --git a/tests/model_hub_tests/torch_tests/detectron2_models b/tests/model_hub_tests/torch_tests/detectron2_models new file mode 100644 index 00000000000000..091464ab8d3080 --- /dev/null +++ b/tests/model_hub_tests/torch_tests/detectron2_models @@ -0,0 +1,65 @@ +COCO-Detection/fast_rcnn_R_50_FPN_1x,none +COCO-Detection/faster_rcnn_R_101_C4_3x,none +COCO-Detection/faster_rcnn_R_101_DC5_3x,none +COCO-Detection/faster_rcnn_R_101_FPN_3x,none +COCO-Detection/faster_rcnn_R_50_C4_1x,none +COCO-Detection/faster_rcnn_R_50_C4_3x,none +COCO-Detection/faster_rcnn_R_50_DC5_1x,none +COCO-Detection/faster_rcnn_R_50_DC5_3x,none +COCO-Detection/faster_rcnn_R_50_FPN_1x,none +COCO-Detection/faster_rcnn_R_50_FPN_3x,none +COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x,none +COCO-Detection/retinanet_R_101_FPN_3x,none +COCO-Detection/retinanet_R_50_FPN_1x,none +COCO-Detection/retinanet_R_50_FPN_3x,none +COCO-Detection/rpn_R_50_C4_1x,none +COCO-Detection/rpn_R_50_FPN_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x,none +COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x,none +COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x,none +#COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_giou,none - Pretrained model is not available! +COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x,none +COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x,none +#COCO-Keypoints/Base-Keypoint-RCNN-FPN,none - Pretrained model is not available! +COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x,none +COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x,none +COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x,none +COCO-Keypoints/keypoint_rcnn_X_101_32x8d_FPN_3x,none +#COCO-PanopticSegmentation/Base-Panoptic-FPN,none - Pretrained model is not available! +COCO-PanopticSegmentation/panoptic_fpn_R_101_3x,none +COCO-PanopticSegmentation/panoptic_fpn_R_50_1x,none +COCO-PanopticSegmentation/panoptic_fpn_R_50_3x,none +Cityscapes/mask_rcnn_R_50_FPN,none +Detectron1-Comparisons/faster_rcnn_R_50_FPN_noaug_1x,none +Detectron1-Comparisons/keypoint_rcnn_R_50_FPN_1x,none +Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x,none +LVISv0.5-InstanceSegmentation/mask_rcnn_R_101_FPN_1x,none +LVISv0.5-InstanceSegmentation/mask_rcnn_R_50_FPN_1x,none +LVISv0.5-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x,none +#LVISv1-InstanceSegmentation/mask_rcnn_R_101_FPN_1x,none - Pretrained model is not available! +#LVISv1-InstanceSegmentation/mask_rcnn_R_50_FPN_1x,none - Pretrained model is not available! +#LVISv1-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x,none - Pretrained model is not available! +#Misc/mask_rcnn_R_50_FPN_1x_cls_agnostic,none - Pretrained model is not available! +Misc/cascade_mask_rcnn_R_50_FPN_1x,none +Misc/cascade_mask_rcnn_R_50_FPN_3x,none +Misc/cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv,none +Misc/mask_rcnn_R_50_FPN_1x_dconv_c3-c5,none +Misc/mask_rcnn_R_50_FPN_3x_dconv_c3-c5,none +Misc/mask_rcnn_R_50_FPN_3x_gn,none +Misc/mask_rcnn_R_50_FPN_3x_syncbn,none +Misc/panoptic_fpn_R_101_dconv_cascade_gn_3x,none +Misc/scratch_mask_rcnn_R_50_FPN_3x_gn,none +Misc/scratch_mask_rcnn_R_50_FPN_9x_gn,none +Misc/scratch_mask_rcnn_R_50_FPN_9x_syncbn,none +#Misc/semantic_R_50_FPN_1x,none - Pretrained model is not available! +PascalVOC-Detection/faster_rcnn_R_50_C4,none +#PascalVOC-Detection/faster_rcnn_R_50_FPN,none - Pretrained model is not available! +#Base-RCNN-C4,none - Pretrained model is not available! +#Base-RCNN-DilatedC5,none - Pretrained model is not available! +#Base-RCNN-FPN,none - Pretrained model is not available! +#Base-RetinaNet,none - Pretrained model is not available! diff --git a/tests/model_hub_tests/torch_tests/detectron2_precommit b/tests/model_hub_tests/torch_tests/detectron2_precommit new file mode 100644 index 00000000000000..155e4d2a359779 --- /dev/null +++ b/tests/model_hub_tests/torch_tests/detectron2_precommit @@ -0,0 +1,26 @@ +COCO-Detection/faster_rcnn_R_50_C4_1x,none +COCO-Detection/faster_rcnn_R_50_DC5_3x,none +COCO-Detection/faster_rcnn_R_50_FPN_1x,none +COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x,none +COCO-Detection/retinanet_R_50_FPN_1x,none +COCO-Detection/rpn_R_50_C4_1x,none +COCO-Detection/rpn_R_50_FPN_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x,none +COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x,none +COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x,none +COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x,none +COCO-Keypoints/keypoint_rcnn_X_101_32x8d_FPN_3x,none +Cityscapes/mask_rcnn_R_50_FPN,none +Detectron1-Comparisons/faster_rcnn_R_50_FPN_noaug_1x,none +Detectron1-Comparisons/keypoint_rcnn_R_50_FPN_1x,none +Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x,none +LVISv0.5-InstanceSegmentation/mask_rcnn_R_50_FPN_1x,none +LVISv0.5-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x,none +Misc/cascade_mask_rcnn_R_50_FPN_3x,none +Misc/cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv,none +Misc/mask_rcnn_R_50_FPN_3x_dconv_c3-c5,none +Misc/mask_rcnn_R_50_FPN_3x_gn,none +Misc/mask_rcnn_R_50_FPN_3x_syncbn,none +Misc/scratch_mask_rcnn_R_50_FPN_9x_syncbn,none +PascalVOC-Detection/faster_rcnn_R_50_C4,none diff --git a/tests/model_hub_tests/torch_tests/requirements.txt b/tests/model_hub_tests/torch_tests/requirements.txt index de68479afe714e..9a859794b09d04 100644 --- a/tests/model_hub_tests/torch_tests/requirements.txt +++ b/tests/model_hub_tests/torch_tests/requirements.txt @@ -4,4 +4,4 @@ pytest pytest-html torch torchvision -av \ No newline at end of file +av diff --git a/tests/model_hub_tests/torch_tests/requirements_secondary.txt b/tests/model_hub_tests/torch_tests/requirements_secondary.txt new file mode 100644 index 00000000000000..f59753797b27a0 --- /dev/null +++ b/tests/model_hub_tests/torch_tests/requirements_secondary.txt @@ -0,0 +1,3 @@ +-c ../../constraints.txt +# This file contains requirements dependednt from modules in requirements.txt +git+https://github.com/facebookresearch/detectron2.git \ No newline at end of file diff --git a/tests/model_hub_tests/torch_tests/test_detectron2.py b/tests/model_hub_tests/torch_tests/test_detectron2.py new file mode 100644 index 00000000000000..e8859905622260 --- /dev/null +++ b/tests/model_hub_tests/torch_tests/test_detectron2.py @@ -0,0 +1,93 @@ +# Copyright (C) 2018-2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import os +import pytest +import torch +from models_hub_common.test_convert_model import TestConvertModel +from openvino import convert_model +from models_hub_common.utils import get_models_list, compare_two_tensors + + +class TestDetectron2ConvertModel(TestConvertModel): + def setup_class(self): + from PIL import Image + import requests + + url = "http://images.cocodataset.org/val2017/000000039769.jpg" + self.image = Image.open(requests.get(url, stream=True).raw) + self.image = self.image.resize([640, 480]) + + def load_model(self, model_name, model_link): + from detectron2 import model_zoo, export + from detectron2.modeling import build_model + from detectron2.checkpoint import DetectionCheckpointer + from detectron2.config import CfgNode + import torchvision.transforms as transforms + + transform = transforms.Compose([transforms.PILToTensor()]) + image = transform(self.image) + + cfg = model_zoo.get_config(model_name + ".yaml", trained=True) + assert isinstance(cfg, CfgNode), "Unexpected config" + cfg.MODEL.DEVICE = "cpu" + model = build_model(cfg) + DetectionCheckpointer(model, save_to_disk=False).load(cfg.MODEL.WEIGHTS) + + model.eval() + inputs = [{"image": image, + "height": torch.tensor(image.shape[1]), + "width": torch.tensor(image.shape[2])}] + adapter = export.TracingAdapter(model, inputs) + + self.example = adapter.flattened_inputs + return adapter + + def get_inputs_info(self, model_obj): + return None + + def prepare_inputs(self, inputs_info): + return [i.numpy() for i in self.example] + + def convert_model(self, model_obj): + ov_model = convert_model(model_obj, example_input=self.example) + return ov_model + + def infer_fw_model(self, model_obj, inputs): + fw_outputs = model_obj(*[torch.from_numpy(i) for i in inputs]) + if isinstance(fw_outputs, dict): + for k in fw_outputs.keys(): + fw_outputs[k] = fw_outputs[k].numpy(force=True) + elif isinstance(fw_outputs, (list, tuple)): + fw_outputs = [o.numpy(force=True) for o in fw_outputs] + else: + fw_outputs = [fw_outputs.numpy(force=True)] + return fw_outputs + + def compare_results(self, fw_outputs, ov_outputs): + assert len(fw_outputs) == len(ov_outputs), \ + "Different number of outputs between TensorFlow and OpenVINO:" \ + " {} vs. {}".format(len(fw_outputs), len(ov_outputs)) + + fw_eps = 5e-2 + is_ok = True + for i in range(len(ov_outputs)): + cur_fw_res = fw_outputs[i] + cur_ov_res = ov_outputs[i] + l = min(len(cur_fw_res), len(cur_ov_res)) + assert l > 0 or len(cur_fw_res) == len(cur_ov_res), "No boxes were selected." + print(f"fw_re: {cur_fw_res};\n ov_res: {cur_ov_res}") + is_ok = compare_two_tensors(cur_ov_res[:l], cur_fw_res[:l], fw_eps) + assert is_ok, "Accuracy validation failed" + + @pytest.mark.parametrize("name,type,mark,reason", + get_models_list(os.path.join(os.path.dirname(__file__), "detectron2_precommit"))) + @pytest.mark.precommit + def test_detectron2_precommit(self, name, type, mark, reason, ie_device): + self.run(name, None, ie_device) + + @pytest.mark.parametrize("name,type,mark,reason", + get_models_list(os.path.join(os.path.dirname(__file__), "detectron2_models"))) + @pytest.mark.nightly + def test_detectron2_all_models(self, name, type, mark, reason, ie_device): + self.run(name, None, ie_device) From df19699e3a6d3db2adcc88602bfd6922f42f6f68 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Mon, 18 Sep 2023 16:18:05 +0400 Subject: [PATCH 10/12] [TF Hub API][TF FE] Support TF Keras Model OOB without example_input (#19892) * [TF Hub] Cover TF Hub use cases with adoption to OpenVINO This is necessarily to demonstrate support of models programmed with TF Hub API through OV notebooks. Signed-off-by: Kazantsev, Roman * Preserve original keras input and output tensor names * Add tests with TF Hub API models * No KerasLayer handling * Handle specific signature --------- Signed-off-by: Kazantsev, Roman --- .../src/openvino/frontend/tensorflow/utils.py | 105 +++++++++++++++++- .../models_hub_common/test_convert_model.py | 12 +- .../tf_hub_tests/test_tf_hub_api_notebooks.py | 63 +++++++++++ .../tf_hub_tests/test_tf_hub_convert_model.py | 14 +-- tests/model_hub_tests/tf_hub_tests/utils.py | 33 ++++++ 5 files changed, 206 insertions(+), 21 deletions(-) create mode 100644 tests/model_hub_tests/tf_hub_tests/test_tf_hub_api_notebooks.py create mode 100644 tests/model_hub_tests/tf_hub_tests/utils.py diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py index d796f1cfb8fb73..056e0904b4c22f 100644 --- a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py +++ b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py @@ -63,7 +63,7 @@ def get_imported_module_version(imported_module): for attr in version_attrs: installed_version = getattr(imported_module, attr, None) if isinstance(installed_version, str): - return installed_version + return installed_version else: installed_version = None @@ -98,7 +98,8 @@ def get_environment_setup(framework): def trace_tf_model_if_needed(input_model, placeholder_shapes, placeholder_data_types, example_input): import tensorflow as tf - if not isinstance(input_model, (tf.keras.layers.Layer, tf.Module, tf.keras.Model, tf.types.experimental.GenericFunction)): + if not isinstance(input_model, + (tf.keras.layers.Layer, tf.Module, tf.keras.Model, tf.types.experimental.GenericFunction)): return input_model return trace_tf_model(input_model, placeholder_shapes, placeholder_data_types, example_input) @@ -175,6 +176,65 @@ def get_concrete_func(tf_function, example_input, input_needs_packing, error_mes return concrete_func +def create_generic_function_from_keras_model(keras_model): + import tensorflow as tf + assert isinstance(keras_model, tf.keras.Model), \ + "[TensorFlow Frontend] internal error: the input model must be of Keras model type" + if not hasattr(keras_model, 'input') or getattr(keras_model, 'input') is None: + return None + keras_input_signature = getattr(keras_model, 'input') + tf_input_signature = None + wrapper_function = None + if isinstance(keras_input_signature, dict): + tf_input_signature = [] + for tensor_name, tensor_spec in keras_input_signature.items(): + tf_input_signature.append(tf.TensorSpec(shape=tensor_spec.shape, + dtype=tensor_spec.dtype, + name=tensor_name)) + elif isinstance(keras_input_signature, list): + tf_input_signature = [] + for tensor_spec in keras_input_signature: + tf_input_signature.append(tf.TensorSpec(shape=tensor_spec.shape, + dtype=tensor_spec.dtype, + name=tensor_spec.name)) + else: + try: + # single KerasTensor case + tf_input_signature = [] + tf_input_signature.append(tf.TensorSpec(shape=keras_input_signature.shape, + dtype=keras_input_signature.dtype, + name=keras_input_signature.name)) + except: + tf_input_signature = None + if tf_input_signature is not None: + @tf.function(input_signature=tf_input_signature) + def wrapper_function_dict(*args): + input_dict = {} + for ind, tensor_spec in enumerate(tf_input_signature): + input_dict[tensor_spec.name] = args[ind] + outputs = keras_model(input_dict) + # need to wrap the output into dictionary + # it helps to preserve original keras tensor names + post_outputs = {} + if isinstance(outputs, dict): + for output_name, output_value in outputs.items(): + post_outputs[output_name] = output_value + else: + try: + if isinstance(outputs, list) and isinstance(keras_model.outputs, list) and \ + len(outputs) == len(keras_model.outputs): + for output_value, output_tensor in zip(outputs, keras_model.outputs): + post_outputs[output_tensor.name] = output_value + else: + post_outputs[keras_model.output.name] = outputs + except: + post_outputs = outputs + return post_outputs + + wrapper_function = wrapper_function_dict + return wrapper_function + + def trace_tf_model(model, input_shapes, input_types, example_input): import tensorflow as tf if isinstance(model.__call__, tf.types.experimental.GenericFunction): @@ -183,12 +243,25 @@ def trace_tf_model(model, input_shapes, input_types, example_input): elif isinstance(model, tf.types.experimental.GenericFunction): tf_function = model input_needs_packing = False + elif isinstance(model, tf.keras.Model): + tf_function = create_generic_function_from_keras_model(model) + if tf_function is not None: + input_needs_packing = False + else: + # Wrap model to tf.Function. + # In this case we loose input/output tensor names. + @tf.function + def tf_function(args): + return model(*args) + + input_needs_packing = True else: # Wrap model to tf.Function. # In this case we loose input/output tensor names. @tf.function def tf_function(args): return model(*args) + input_needs_packing = True if example_input is not None: @@ -216,7 +289,8 @@ def tf_function(args): def type_supported_by_tf_fe(input_model): import tensorflow as tf # Types that require tracing - if isinstance(input_model, (tf.keras.layers.Layer, tf.Module, tf.keras.Model, tf.types.experimental.GenericFunction)): + if isinstance(input_model, + (tf.keras.layers.Layer, tf.Module, tf.keras.Model, tf.types.experimental.GenericFunction)): return True # Types that do not require tracing if isinstance(input_model, (tf.Graph, tf.types.experimental.ConcreteFunction)): @@ -246,7 +320,15 @@ def create_tf_graph_iterator(input_model, placeholder_shapes, placeholder_data_t if func_input.dtype == tf.resource: continue internal_tensor_names.append(func_input.name) - if len(input_model.structured_input_signature) > 1 and \ + if len(input_model.structured_input_signature) > 0 and \ + len(internal_tensor_names) == len(input_model.structured_input_signature[0]): + for internal_name, tensor_spec in zip(internal_tensor_names, input_model.structured_input_signature[0]): + input_names_map = input_names_map or {} + if not isinstance(tensor_spec, tf.TensorSpec): + input_names_map = None + break + input_names_map[internal_name] = tensor_spec.name + elif len(input_model.structured_input_signature) > 1 and \ len(internal_tensor_names) == len(input_model.structured_input_signature[1]): external_tensor_names = sorted(input_model.structured_input_signature[1].keys()) for internal_name, external_name in zip(internal_tensor_names, external_tensor_names): @@ -262,6 +344,19 @@ def create_tf_graph_iterator(input_model, placeholder_shapes, placeholder_data_t for external_name, internal_name in zip(external_names, internal_names): output_names_map = output_names_map or {} output_names_map[internal_name] = external_name + else: + for external_name, internal_tensor in input_model.structured_outputs.items(): + internal_tf_tensor = None + if isinstance(internal_tensor, tf.Tensor): + internal_tf_tensor = internal_tensor + if isinstance(internal_tensor, list) and len(internal_tensor) > 0 and \ + isinstance(internal_tensor[0], tf.Tensor): + internal_tf_tensor = internal_tensor[0] + if internal_tf_tensor is None: + output_names_map = None + break + output_names_map = output_names_map or {} + output_names_map[internal_tf_tensor.name] = external_name return GraphIteratorTFGraph(input_model.graph, share_weights, False, input_names_map, output_names_map) raise Exception("Could not wrap model of type {} to GraphIteratorTFGraph.".format(type(input_model))) @@ -271,7 +366,7 @@ def extract_model_graph(argv): import tensorflow as tf trackable_is_imported = False try: - from tensorflow.python.training.tracking.base import Trackable # pylint: disable=no-name-in-module,import-error + from tensorflow.python.training.tracking.base import Trackable # pylint: disable=no-name-in-module,import-error trackable_is_imported = True except: log.warning("Could not import tensorflow.python.training.tracking.base.Trackable type.") diff --git a/tests/model_hub_tests/models_hub_common/test_convert_model.py b/tests/model_hub_tests/models_hub_common/test_convert_model.py index e64a8d17ea5076..145da6b61761f7 100644 --- a/tests/model_hub_tests/models_hub_common/test_convert_model.py +++ b/tests/model_hub_tests/models_hub_common/test_convert_model.py @@ -35,9 +35,15 @@ def prepare_input(self, input_shape, input_type): assert False, "Unsupported type {}".format(input_type) def prepare_inputs(self, inputs_info): - inputs = {} - for input_name, input_shape, input_type in inputs_info: - inputs[input_name] = self.prepare_input(input_shape, input_type) + if len(inputs_info) > 0 and inputs_info[0] == 'list': + inputs = [] + inputs_info = inputs_info[1:] + for input_name, input_shape, input_type in inputs_info: + inputs.append(self.prepare_input(input_shape, input_type)) + else: + inputs = {} + for input_name, input_shape, input_type in inputs_info: + inputs[input_name] = self.prepare_input(input_shape, input_type) return inputs def convert_model(self, model_obj): diff --git a/tests/model_hub_tests/tf_hub_tests/test_tf_hub_api_notebooks.py b/tests/model_hub_tests/tf_hub_tests/test_tf_hub_api_notebooks.py new file mode 100644 index 00000000000000..fe006d3860f56f --- /dev/null +++ b/tests/model_hub_tests/tf_hub_tests/test_tf_hub_api_notebooks.py @@ -0,0 +1,63 @@ +# Copyright (C) 2018-2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import pytest +import tensorflow as tf +import tensorflow_hub as hub +from models_hub_common.test_convert_model import TestConvertModel +from tf_hub_tests.utils import get_input_info + + +class TestTFHubApiNotebooks(TestConvertModel): + def load_model(self, model_name, model_link): + if model_name == 'mobilenet_v2_100_224_dict': + image = tf.keras.layers.Input(shape=(224, 224, 3), dtype=tf.float32, name="image") + feature_vector = hub.KerasLayer("https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/5", + trainable=False)(image) + softmax = tf.keras.layers.Dense(20, activation='softmax')(feature_vector) + classification_model = tf.keras.Model(inputs={'image': image}, outputs={'softmax': softmax}) + return classification_model + elif model_name == 'mobilenet_v2_100_224_list': + image = tf.keras.layers.Input(shape=(224, 224, 3), dtype=tf.float32, name="image") + feature_vector = hub.KerasLayer("https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/5", + trainable=False)(image) + softmax = tf.keras.layers.Dense(20, activation='softmax')(feature_vector) + classification_model = tf.keras.Model(inputs=[image], outputs=[softmax]) + return classification_model + else: + raise "Unknown input model: {}".format(model_name) + + def get_inputs_info(self, keras_model): + inputs_info = [] + if isinstance(keras_model.input, dict): + for input_name, input_tensor in keras_model.input.items(): + inputs_info.append(get_input_info(input_tensor, input_name)) + elif isinstance(keras_model.input, list): + inputs_info.append('list') + for input_tensor in keras_model.input: + inputs_info.append(get_input_info(input_tensor, input_tensor.name)) + else: + inputs_info.append('list') + input_tensor = keras_model.input + inputs_info.append(get_input_info(input_tensor, input_tensor.name)) + return inputs_info + + def infer_fw_model(self, model_obj, inputs): + outputs = model_obj(inputs) + if isinstance(outputs, dict): + post_outputs = {} + for out_name, out_value in outputs.items(): + post_outputs[out_name] = out_value.numpy() + elif isinstance(outputs, list): + post_outputs = [] + for out_value in outputs: + post_outputs.append(out_value.numpy()) + else: + post_outputs = [outputs.numpy()] + + return post_outputs + + @pytest.mark.precommit + @pytest.mark.parametrize("model_name", ['mobilenet_v2_100_224_dict', 'mobilenet_v2_100_224_list']) + def test_tf_hub_api_notebook1(self, model_name, ie_device): + self.run(model_name, '', ie_device) diff --git a/tests/model_hub_tests/tf_hub_tests/test_tf_hub_convert_model.py b/tests/model_hub_tests/tf_hub_tests/test_tf_hub_convert_model.py index 94fe5bba83e37c..c596273d92c8f1 100644 --- a/tests/model_hub_tests/tf_hub_tests/test_tf_hub_convert_model.py +++ b/tests/model_hub_tests/tf_hub_tests/test_tf_hub_convert_model.py @@ -5,7 +5,6 @@ import os import shutil -import numpy as np import pytest import tensorflow as tf import tensorflow_hub as hub @@ -14,6 +13,7 @@ from models_hub_common.constants import tf_hub_cache_dir from models_hub_common.test_convert_model import TestConvertModel from models_hub_common.utils import get_models_list +from tf_hub_tests.utils import type_map class TestTFHubConvertModel(TestConvertModel): @@ -49,18 +49,6 @@ def get_inputs_info(self, model_obj): except ValueError: # unknown rank case pass - type_map = { - tf.float64: np.float64, - tf.float32: np.float32, - tf.int8: np.int8, - tf.int16: np.int16, - tf.int32: np.int32, - tf.int64: np.int64, - tf.uint8: np.uint8, - tf.uint16: np.uint16, - tf.string: str, - tf.bool: bool, - } if input_info.dtype == tf.resource: # skip inputs corresponding to variables continue diff --git a/tests/model_hub_tests/tf_hub_tests/utils.py b/tests/model_hub_tests/tf_hub_tests/utils.py new file mode 100644 index 00000000000000..61f10d9d27af84 --- /dev/null +++ b/tests/model_hub_tests/tf_hub_tests/utils.py @@ -0,0 +1,33 @@ +# Copyright (C) 2018-2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import tensorflow as tf + +type_map = { + tf.float64: np.float64, + tf.float32: np.float32, + tf.int8: np.int8, + tf.int16: np.int16, + tf.int32: np.int32, + tf.int64: np.int64, + tf.uint8: np.uint8, + tf.uint16: np.uint16, + tf.string: str, + tf.bool: bool, +} + + +def get_input_info(input_tensor, input_name): + input_shape = [] + try: + for dim in input_tensor.shape.as_list(): + if dim is None: + input_shape.append(1) + else: + input_shape.append(dim) + except ValueError: + # unknown rank case + pass + assert input_tensor.dtype in type_map, "Unsupported input type: {}".format(input_tensor.dtype) + return input_name, input_shape, type_map[input_tensor.dtype] From d90ceb93d167bc6713559f8ec00778230dea2b14 Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Mon, 18 Sep 2023 16:51:33 +0400 Subject: [PATCH 11/12] [TF Hub][TF FE] Fix 5D case for FusedBatchNorm (#19904) Signed-off-by: Kazantsev, Roman --- .../tensorflow_common/src/op/fused_batch_norm.cpp | 2 +- .../layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py | 7 ++++++- tests/model_hub_tests/tf_hub_tests/precommit_models | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp b/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp index 656213e157394c..027b5fcdf0df9a 100644 --- a/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp +++ b/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp @@ -146,7 +146,7 @@ void compute_fused_batch_norm_inference(const NodeContext& node, // retrieve attributes auto epsilon = node.get_attribute("epsilon", 0.0001f); auto data_format = node.get_attribute("data_format", "NHWC"); - bool is_nhwc = (data_format == "NHWC"); + bool is_nhwc = (data_format == "NHWC" || data_format == "NDHWC"); // create auxiliary Constant nodes for some attributes: epsilon and exponential_avg_factor auto eps_const = create_same_type_const_scalar(x, epsilon); diff --git a/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py b/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py index 884a8a5bf4414f..94ae7dc628270d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_FusedBatchNorm.py @@ -35,7 +35,7 @@ def create_fused_batch_norm_net(self, x_shape, epsilon, exponential_avg_factor, # Create the graph and model with tf.compat.v1.Session() as sess: c_dim = x_shape[-1] - if data_format == "NCHW": + if data_format == "NCHW" or data_format == "NCDHW": c_dim = x_shape[1] x = tf.compat.v1.placeholder(tf.float32, x_shape, 'x') if empty_mean_variance: @@ -92,6 +92,11 @@ def create_fused_batch_norm_net(self, x_shape, epsilon, exponential_avg_factor, fbn_version="v3"), dict(x_shape=[5, 10, 8, 2], epsilon=0.0002, exponential_avg_factor=0.2, data_format="NHWC", is_training=True, fbn_version="v3", empty_mean_variance=False), + # 5D cases + dict(x_shape=[5, 4, 3, 2, 3], epsilon=0.0005, exponential_avg_factor=0.0, data_format="NCDHW", + is_training=False, fbn_version="v3"), + dict(x_shape=[3, 4, 3, 3, 2], epsilon=0.0003, exponential_avg_factor=0.0, data_format="NDHWC", + is_training=False, fbn_version="v3"), ] @pytest.mark.parametrize("params", test_data_basic) diff --git a/tests/model_hub_tests/tf_hub_tests/precommit_models b/tests/model_hub_tests/tf_hub_tests/precommit_models index 90dd3f4c5e1c17..f9be334761d23c 100644 --- a/tests/model_hub_tests/tf_hub_tests/precommit_models +++ b/tests/model_hub_tests/tf_hub_tests/precommit_models @@ -9,6 +9,7 @@ imagenet/efficientnet_v2_imagenet1k_b0/feature_vector,https://tfhub.dev/google/i imagenet/mobilenet_v1_100_224/classification,https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/5?tf-hub-format=compressed,skip,119718 - Accuracy issue magenta/arbitrary-image-stylization-v1-256,https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2?tf-hub-format=compressed small_bert/bert_en_uncased_L-4_H-256_A-4,https://tfhub.dev/tensorflow/small_bert/bert_en_uncased_L-4_H-256_A-4/2?tf-hub-format=compressed,skip,119718 - Accuracy issue +movinet/a5/base/kinetics-600/classification,https://tfhub.dev/tensorflow/movinet/a5/base/kinetics-600/classification/3?tf-hub-format=compressed # secure notebook models unet/industrial/class_1,https://tfhub.dev/nvidia/unet/industrial/class_1/1?tf-hub-format=compressed movenet/singlepose/thunder,https://tfhub.dev/google/movenet/singlepose/thunder/4?tf-hub-format=compressed From 6df420ed67c6978e76bf54679caafb29a17609e1 Mon Sep 17 00:00:00 2001 From: Artyom Anokhov Date: Mon, 18 Sep 2023 15:36:55 +0200 Subject: [PATCH 12/12] [Azure] Fix linux_debian.yml (#19911) * Update linux_debian.yml Fixed apt-get update * More fixes --------- Co-authored-by: Ilya Lavrenov --- .ci/azure/linux_debian.yml | 2 +- .github/workflows/linux_debian.yml | 2 +- cmake/packaging/debian.cmake | 1 + cmake/packaging/rpm.cmake | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.ci/azure/linux_debian.yml b/.ci/azure/linux_debian.yml index 96db6129c72ee1..e94a0819705bd7 100644 --- a/.ci/azure/linux_debian.yml +++ b/.ci/azure/linux_debian.yml @@ -228,7 +228,7 @@ jobs: wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2023.list - sudo apt-get update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/intel-openvino-2023.list + sudo apt-get update sudo apt-get install openvino -y # install our local one and make sure the conflicts are resolved sudo apt-get install --no-install-recommends dpkg-dev -y diff --git a/.github/workflows/linux_debian.yml b/.github/workflows/linux_debian.yml index b517a368c46ced..bff429be48c90a 100644 --- a/.github/workflows/linux_debian.yml +++ b/.github/workflows/linux_debian.yml @@ -219,7 +219,7 @@ jobs: wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2023.list - sudo apt-get update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/intel-openvino-2023.list + sudo apt-get update sudo apt-get install openvino -y # install our local one and make sure the conflicts are resolved sudo apt-get install --no-install-recommends dpkg-dev -y diff --git a/cmake/packaging/debian.cmake b/cmake/packaging/debian.cmake index 48adc7acf3980a..d359a40aa6df51 100644 --- a/cmake/packaging/debian.cmake +++ b/cmake/packaging/debian.cmake @@ -91,6 +91,7 @@ macro(ov_cpack_settings) # - 2022.3 is the first release where Debian updated packages are introduced, others 2022.3.X are LTS 2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5 2023.0.0 2023.0.1 2023.0.2 2023.0.3 + 2023.1.0 ) # diff --git a/cmake/packaging/rpm.cmake b/cmake/packaging/rpm.cmake index ad1172b6c833ae..077e970d138bc4 100644 --- a/cmake/packaging/rpm.cmake +++ b/cmake/packaging/rpm.cmake @@ -77,6 +77,7 @@ macro(ov_cpack_settings) # - 2022.3 is the first release where RPM updated packages are introduced, others 2022.3.X are LTS 2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5 2023.0.0 2023.0.1 2023.0.2 2023.0.3 + 2023.1.0 ) find_host_program(rpmlint_PROGRAM NAMES rpmlint DOC "Path to rpmlint")