diff --git a/.github/actions/cache/dist/save-only/index.js b/.github/actions/cache/dist/save-only/index.js index 7985f6da76b..e49fde473b4 100644 --- a/.github/actions/cache/dist/save-only/index.js +++ b/.github/actions/cache/dist/save-only/index.js @@ -33258,7 +33258,7 @@ async function save() { // remote cache directory may not be created yet if (!(await checkFileExists(cacheRemotePath))) { - await fs.mkdir(cacheRemotePath); + await fs.mkdir(cacheRemotePath, { recursive: true }); } core.info('Copying cache...'); diff --git a/.github/actions/cache/dist/save/index.js b/.github/actions/cache/dist/save/index.js index 7985f6da76b..e49fde473b4 100644 --- a/.github/actions/cache/dist/save/index.js +++ b/.github/actions/cache/dist/save/index.js @@ -33258,7 +33258,7 @@ async function save() { // remote cache directory may not be created yet if (!(await checkFileExists(cacheRemotePath))) { - await fs.mkdir(cacheRemotePath); + await fs.mkdir(cacheRemotePath, { recursive: true }); } core.info('Copying cache...'); diff --git a/.github/actions/cache/src/saveImpl.js b/.github/actions/cache/src/saveImpl.js index 275b3d048e6..68adba78cd8 100644 --- a/.github/actions/cache/src/saveImpl.js +++ b/.github/actions/cache/src/saveImpl.js @@ -50,7 +50,7 @@ async function save() { // remote cache directory may not be created yet if (!(await checkFileExists(cacheRemotePath))) { - await fs.mkdir(cacheRemotePath); + await fs.mkdir(cacheRemotePath, { recursive: true }); } core.info('Copying cache...'); diff --git a/.github/actions/setup_python/action.yml b/.github/actions/setup_python/action.yml index 6ead25c2f2e..0d9138bc643 100644 --- a/.github/actions/setup_python/action.yml +++ b/.github/actions/setup_python/action.yml @@ -23,7 +23,19 @@ runs: using: 'composite' steps: - - if: ${{ runner.os == 'Linux' && inputs.self-hosted-runner == 'true' }} + - name: Check if Python is already installed (Linux) + if: ${{ runner.os == 'Linux' }} + shell: bash + id: check_python + run: | + PYTHON_INSTALLED=$(python${{ inputs.version }} -V) || true + if [[ $PYTHON_INSTALLED ]]; then + echo "installed=true" >> $GITHUB_OUTPUT + else + echo "installed=false" >> $GITHUB_OUTPUT + fi + + - if: ${{ runner.os == 'Linux' && inputs.self-hosted-runner == 'true' && steps.check_python.outputs.installed == 'false' }} name: Install 'actions/setup-python@v4' dependencies shell: bash run: apt-get update && apt-get install -y ca-certificates software-properties-common gpg-agent tzdata @@ -31,18 +43,18 @@ runs: DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input TZ: "Europe/London" # to prevent tzdata from waiting user input - - if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }} + - if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && steps.check_python.outputs.installed == 'false' }} name: Setup sudo and python3 shell: bash run: apt-get update && apt-get install -y sudo python3 # Needed for the deadsnakes action - - if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }} + - if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && steps.check_python.outputs.installed == 'false' }} name: Setup Python ${{ inputs.version }} uses: akashchi/deadsnakes-action@92417281055a5878a0450f240a5b95883eb2d7e2 with: python-version: ${{ inputs.version }} - - if: ${{ runner.os == 'macOS' || runner.os == 'Windows' || (runner.os == 'Linux' && runner.arch != 'ARM64') }} + - if: ${{ runner.os == 'macOS' || runner.os == 'Windows' || (runner.os == 'Linux' && runner.arch != 'ARM64' && steps.check_python.outputs.installed == 'false' ) }} name: Setup Python ${{ inputs.version }} uses: actions/setup-python@v5 with: diff --git a/.github/dockerfiles/docker_tag b/.github/dockerfiles/docker_tag index 452490c748b..67a7eec64a3 100644 --- a/.github/dockerfiles/docker_tag +++ b/.github/dockerfiles/docker_tag @@ -1 +1 @@ -pr-24689 \ No newline at end of file +pr-24878 diff --git a/.github/dockerfiles/ov_build/ubuntu_20_04_x64_nvidia/Dockerfile b/.github/dockerfiles/ov_build/ubuntu_20_04_x64_nvidia/Dockerfile new file mode 100644 index 00000000000..c192227085e --- /dev/null +++ b/.github/dockerfiles/ov_build/ubuntu_20_04_x64_nvidia/Dockerfile @@ -0,0 +1,89 @@ +FROM openvinogithubactions.azurecr.io/dockerhub/nvidia/cuda:11.8.0-runtime-ubuntu20.04 + +USER root + +# APT configuration +RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \ + echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf + +ENV DEBIAN_FRONTEND="noninteractive" \ + TZ="Europe/London" + +RUN apt-get update && \ + apt-get install software-properties-common && \ + add-apt-repository --yes --no-update ppa:git-core/ppa && \ + add-apt-repository --yes --no-update ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install \ + curl \ + wget \ + git \ + ca-certificates \ + gpg-agent \ + tzdata \ + # Pythons + python3.8-dev \ + python3.8-venv \ + python3.8-distutils \ + python3.11-dev \ + python3.11-venv \ + python3.11-distutils \ + # For Java API + default-jdk \ + # Compiler \ + gcc-10 \ + g++-10 \ + && \ + rm -rf /var/lib/apt/lists/* + +# Install build dependencies +ADD install_build_dependencies.sh /install_build_dependencies.sh +RUN chmod +x /install_build_dependencies.sh && \ + /install_build_dependencies.sh && \ + rm -rf /var/lib/apt/lists/* + +# Set gcc-10 as a default compiler +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30 + +# Install sscache +ARG SCCACHE_VERSION="v0.7.5" +ENV SCCACHE_HOME="/opt/sccache" \ + SCCACHE_PATH="/opt/sccache/sccache" + +RUN mkdir ${SCCACHE_HOME} && cd ${SCCACHE_HOME} && \ + SCCACHE_ARCHIVE="sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" && \ + curl -SLO https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/${SCCACHE_ARCHIVE} && \ + tar -xzf ${SCCACHE_ARCHIVE} --strip-components=1 && rm ${SCCACHE_ARCHIVE} + +# Install CUDA +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin && \ + mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \ + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub && \ + add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" +RUN apt update && apt install -y \ + libcudnn8=8.9.4.*-1+cuda11.8 \ + libcudnn8-dev=8.9.4.*-1+cuda11.8 \ + libcudnn8-samples=8.9.4.*-1+cuda11.8 \ + cuda-runtime-11-8 \ + cuda-11-8 \ + libcutensor1=1.6.1.5-1 \ + libcutensor-dev=1.6.1.5-1 \ + cuda-drivers=520.61.05-1 && \ + rm -rf /var/lib/apt/lists/* + +# Setup pip +ENV PIP_VERSION="24.0" +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.8 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + python3.11 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + rm -f get-pip.py + +# Use Python 3.11 as default instead of Python 3.8 +# Using venv here 'cause other methods to switch the default Python on Ubuntu 20 break both system and wheels build +RUN python3.11 -m venv venv +ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH" + +ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION} diff --git a/.github/dockerfiles/ov_test/ubuntu_20_04_arm64/Dockerfile b/.github/dockerfiles/ov_test/ubuntu_20_04_arm64/Dockerfile index b872db9dc05..68d80858dac 100644 --- a/.github/dockerfiles/ov_test/ubuntu_20_04_arm64/Dockerfile +++ b/.github/dockerfiles/ov_test/ubuntu_20_04_arm64/Dockerfile @@ -48,3 +48,4 @@ RUN python3.11 -m venv venv ENV PATH="/venv/bin:$PATH" ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION} +ENV PIP_INSTALL_PATH=/venv/lib/python3.11/site-packages diff --git a/.github/dockerfiles/ov_test/ubuntu_20_04_x64/Dockerfile b/.github/dockerfiles/ov_test/ubuntu_20_04_x64/Dockerfile new file mode 100644 index 00000000000..0a151be1e68 --- /dev/null +++ b/.github/dockerfiles/ov_test/ubuntu_20_04_x64/Dockerfile @@ -0,0 +1,52 @@ +FROM openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04 + +USER root + +# APT configuration +RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \ + echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf + +ENV DEBIAN_FRONTEND="noninteractive" \ + TZ="Europe/London" + +RUN apt-get update && \ + apt-get install software-properties-common && \ + add-apt-repository --yes --no-update ppa:git-core/ppa && \ + add-apt-repository --yes --no-update ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install \ + curl \ + git \ + ca-certificates \ + gpg-agent \ + tzdata \ + # Python + python3.11-dev \ + python3.11-venv \ + python3.11-distutils \ + libhdf5-dev \ + && \ + rm -rf /var/lib/apt/lists/* + +# Install build dependencies +ADD install_build_dependencies.sh /install_build_dependencies.sh +RUN chmod +x /install_build_dependencies.sh && \ + /install_build_dependencies.sh && \ + rm -rf /var/lib/apt/lists/* + +# Setup pip +ENV PIP_VERSION="24.0" +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.8 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + python3.11 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + rm -f get-pip.py + +# Use Python 3.11 as default instead of Python 3.8 +# Using venv here 'cause other methods to switch the default Python on Ubuntu 20 break both system and wheels build +RUN python3.11 -m venv venv +ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH" + +ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION} +ENV PIP_INSTALL_PATH=/venv/lib/python3.11/site-packages diff --git a/.github/dockerfiles/ov_test/ubuntu_22_04_x64/Dockerfile b/.github/dockerfiles/ov_test/ubuntu_22_04_x64/Dockerfile new file mode 100644 index 00000000000..1566c2305d0 --- /dev/null +++ b/.github/dockerfiles/ov_test/ubuntu_22_04_x64/Dockerfile @@ -0,0 +1,52 @@ +FROM openvinogithubactions.azurecr.io/dockerhub/ubuntu:22.04 + +USER root + +# APT configuration +RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \ + echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \ + echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf + +ENV DEBIAN_FRONTEND="noninteractive" \ + TZ="Europe/London" + +RUN apt-get update && \ + apt-get install software-properties-common && \ + add-apt-repository --yes --no-update ppa:git-core/ppa && \ + add-apt-repository --yes --no-update ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install \ + curl \ + git \ + ca-certificates \ + gpg-agent \ + tzdata \ + # Python + python3.11-dev \ + python3.11-venv \ + python3.11-distutils \ + libhdf5-dev \ + && \ + rm -rf /var/lib/apt/lists/* + +# Install build dependencies +ADD install_build_dependencies.sh /install_build_dependencies.sh +RUN chmod +x /install_build_dependencies.sh && \ + /install_build_dependencies.sh && \ + rm -rf /var/lib/apt/lists/* + +# Setup pip +ENV PIP_VERSION="24.0" +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + python3.11 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \ + rm -f get-pip.py + +# Use Python 3.11 as default +# Using venv here 'cause other methods to switch the default Python on Ubuntu 20 break both system and wheels build +RUN python3.11 -m venv venv +ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH" + +ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION} +ENV PIP_INSTALL_PATH=/venv/lib/python3.11/site-packages diff --git a/.github/scripts/workflow_rerun/errors_to_look_for.json b/.github/scripts/workflow_rerun/errors_to_look_for.json index 26f29ee31c0..51e8106944c 100644 --- a/.github/scripts/workflow_rerun/errors_to_look_for.json +++ b/.github/scripts/workflow_rerun/errors_to_look_for.json @@ -50,5 +50,13 @@ { "error_text": "The requested URL returned error: 500", "ticket": 139384 + }, + { + "error_text": "Unable to fetch some archives", + "ticket": 130965 + }, + { + "error_text": "status_string: \"Timeout was reached\"", + "ticket": 142653 } ] \ No newline at end of file diff --git a/.github/workflows/android_arm64.yml b/.github/workflows/android_arm64.yml index b3dbd98ecbe..a24987d3811 100644 --- a/.github/workflows/android_arm64.yml +++ b/.github/workflows/android_arm64.yml @@ -13,6 +13,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-android-arm64-vcpkg cancel-in-progress: true +permissions: read-all + jobs: Smart_CI: runs-on: ubuntu-latest @@ -21,7 +23,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -75,7 +77,7 @@ jobs: run: apt-get update && apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' @@ -90,7 +92,7 @@ jobs: popd - name: Clone vcpkg - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'microsoft/vcpkg' # Keep in sync with /vcpkg.json @@ -130,7 +132,7 @@ jobs: echo "yes" | ./cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_TOOLS} --install "ndk-bundle" "platform-tools" "platforms;android-${{ env.ANDROID_SDK_VERSION }}" - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.4 + uses: mozilla-actions/sccache-action@2e7f9ec7921547d4b46598398ca573513895d0bd # v0.0.4 with: version: "v0.7.5" @@ -182,7 +184,7 @@ jobs: # Upload build logs # - name: Upload build logs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: build_logs diff --git a/.github/workflows/assign_issue.yml b/.github/workflows/assign_issue.yml index 236705e070b..f466715f5cf 100644 --- a/.github/workflows/assign_issue.yml +++ b/.github/workflows/assign_issue.yml @@ -6,6 +6,8 @@ on: - created - edited +permissions: read-all + jobs: take-issue: name: Take issue @@ -15,7 +17,7 @@ jobs: timeout-minutes: 10 steps: - name: take an issue - uses: bdougie/take-action@v1.6.1 + uses: bdougie/take-action@1439165ac45a7461c2d89a59952cd7d941964b87 # v1.6.1 with: message: Thank you for looking into this issue! Please let us know if you have any questions or require any help. issueCurrentlyAssignedMessage: Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue. diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index 665d1afff1f..320a0913440 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -10,23 +10,25 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} cancel-in-progress: true +permissions: read-all + jobs: Build_Doc: runs-on: ubuntu-20.04 steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' lfs: 'true' - name: Install apt-get dependencies - uses: awalsh128/cache-apt-pkgs-action@v1.4.2 + uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 with: packages: graphviz texlive liblua5.2-0 libclang1-9 libclang-cpp9 version: 3.0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 id: cp310 with: python-version: '3.10' @@ -56,7 +58,7 @@ jobs: - name: Cache documentation id: cache_sphinx_docs - uses: actions/cache@v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: build/docs/_build/.doctrees key: sphinx-docs-cache @@ -70,13 +72,13 @@ jobs: echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - name: 'Upload sphinx.log' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: sphinx_build_log_${{ env.PR_NUMBER }}.log path: build/docs/sphinx.log - name: 'Upload docs html' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_docs_html_${{ env.PR_NUMBER }}.zip path: build/docs/openvino_docs_html.zip @@ -93,7 +95,7 @@ jobs: - name: 'Upload test results' if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_docs_pytest path: build/docs/_artifacts/ diff --git a/.github/workflows/check_pr_commits.yml b/.github/workflows/check_pr_commits.yml index 27af2c56013..571cca477d0 100644 --- a/.github/workflows/check_pr_commits.yml +++ b/.github/workflows/check_pr_commits.yml @@ -1,12 +1,14 @@ name: PR Commits on: [pull_request] +permissions: read-all + jobs: Checks: runs-on: ubuntu-22.04 steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Install dependencies run: python3 -m pip install -r ./.github/github_org_control/requirements.txt diff --git a/.github/workflows/cleanup_caches.yml b/.github/workflows/cleanup_caches.yml index e3022913b67..c5cb8145d70 100644 --- a/.github/workflows/cleanup_caches.yml +++ b/.github/workflows/cleanup_caches.yml @@ -5,6 +5,8 @@ on: # at 00:00 on the 1st day of every month - cron: '0 0 1 * *' +permissions: read-all + jobs: Cleanup_PIP: runs-on: aks-linux-2-cores-8gb @@ -42,7 +44,7 @@ jobs: steps: - name: Checkout cach action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/cache diff --git a/.github/workflows/code_snippets.yml b/.github/workflows/code_snippets.yml index 4a5fe55c93b..36a5489144c 100644 --- a/.github/workflows/code_snippets.yml +++ b/.github/workflows/code_snippets.yml @@ -16,6 +16,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: Build: strategy: @@ -25,12 +27,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' - name: Install OpenCL - uses: awalsh128/cache-apt-pkgs-action@v1.4.2 + uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 if: runner.os == 'Linux' with: packages: ocl-icd-opencl-dev opencl-headers diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 5da10ee1210..4d0ab2e899d 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -5,13 +5,15 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: clang-format: runs-on: ubuntu-22.04 permissions: pull-requests: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' @@ -29,7 +31,7 @@ jobs: - name: suggester / clang-format if: startsWith(github.event_name, 'pull_request') - uses: reviewdog/action-suggester@v1 + uses: reviewdog/action-suggester@9e1cd88b79ba3c0023c94e44accd72344f032093 # v1.13.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} level: warning @@ -40,7 +42,7 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' @@ -58,7 +60,7 @@ jobs: # always provide suggestions even for skipped scripts in ov_shellcheck tagret - name: ShellCheck action if: always() - uses: reviewdog/action-shellcheck@v1 + uses: reviewdog/action-shellcheck@6e3a862f231c6895fbd335b70adef8f9243d5762 # v1.21.0 with: level: style reporter: github-pr-review @@ -71,7 +73,7 @@ jobs: NamingConventionCheck: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a484e0bc873..a00d49814e1 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,6 +5,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: Coverage: runs-on: ${{ matrix.config.os }} @@ -16,19 +18,19 @@ jobs: steps: - name: Setup python - uses: actions/setup-python@v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.10.10' architecture: 'x64' - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13 with: max-size: 50G - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: submodules: 'true' @@ -55,7 +57,7 @@ jobs: python3 -m pip install -r ${{ github.workspace }}/tools/mo/requirements_dev.txt - name: Build OpenVINO with CMake - uses: ashutoshvarma/action-cmake-build@master + uses: ashutoshvarma/action-cmake-build@ade188313bc7eaa6f14349569a64d8bc716342ff # master with: build-dir: ${{ github.workspace }}/build cc: ${{ matrix.config.cc }} @@ -112,7 +114,7 @@ jobs: run: ${{ github.workspace }}/bin/intel64/Release/ov_tensorflow_frontend_tests --gtest_filter=-*IE_GPU* - name: Build coverage with CMake - uses: ashutoshvarma/action-cmake-build@master + uses: ashutoshvarma/action-cmake-build@ade188313bc7eaa6f14349569a64d8bc716342ff # master with: build-dir: ${{ github.workspace }}/coverage cc: ${{ matrix.config.cc }} @@ -135,6 +137,6 @@ jobs: lcov --capture --directory ${{ github.workspace }}/. --output-file coverage.info genhtml coverage.info --output-directory coverage-report - name: Collect coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1 with: verbose: true diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 7d7a2d9faec..2b9ea632345 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -14,6 +14,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux-coverity cancel-in-progress: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -44,14 +46,14 @@ jobs: apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' ref: ${{ inputs.openvinoRef }} - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} @@ -137,7 +139,7 @@ jobs: run: ${COVERITY_TOOL_DIR}/cov-analysis*/bin/cov-configure -c ${COVERITY_TOOL_DIR}/cov-analysis-linux64-2023.6.2/config/coverity_config.xml -lscc text - name: Upload Coverity build log - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: coverity_logs @@ -145,7 +147,7 @@ jobs: if-no-files-found: 'error' - name: Upload Coverity build archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: coverity_archive diff --git a/.github/workflows/dependency_review.yml b/.github/workflows/dependency_review.yml index 99e949e1b77..52db0bc671d 100644 --- a/.github/workflows/dependency_review.yml +++ b/.github/workflows/dependency_review.yml @@ -1,18 +1,17 @@ name: 'Dependency Review' on: [pull_request, merge_group] -permissions: - contents: read +permissions: read-all jobs: dependency-review: runs-on: ubuntu-latest steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Dependency Review - uses: actions/dependency-review-action@v4.3.2 + uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 with: config-file: './.github/dependency_review.yml' base-ref: ${{ github.pull_request.base.sha || github.event.merge_group.base_ref }} diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 303345e91e9..b9efd16b591 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -13,6 +13,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-fedora33 cancel-in-progress: true +permissions: read-all + jobs: Smart_CI: runs-on: ubuntu-latest @@ -21,7 +23,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -71,7 +73,7 @@ jobs: run: yum update -y && yum install -y git - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' @@ -91,7 +93,7 @@ jobs: run: bash ${OPENVINO_REPO}/install_build_dependencies.sh - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.4 + uses: mozilla-actions/sccache-action@2e7f9ec7921547d4b46598398ca573513895d0bd # v0.0.4 with: version: "v0.7.5" @@ -170,7 +172,7 @@ jobs: # Upload build artifacts and logs # - name: Upload build logs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: build_logs @@ -179,7 +181,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -187,7 +189,7 @@ jobs: - name: Upload openvino RPM packages if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_rpm_packages path: ${{ env.BUILD_DIR }}/*.rpm @@ -195,7 +197,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -215,7 +217,7 @@ jobs: steps: - name: Download OpenVINO RPM packages - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_rpm_packages path: ${{ env.RPM_PACKAGES_DIR }} diff --git a/.github/workflows/files_size.yml b/.github/workflows/files_size.yml index 56485765b05..3828943d073 100644 --- a/.github/workflows/files_size.yml +++ b/.github/workflows/files_size.yml @@ -5,11 +5,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: Check_Files_Size: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: git ls-tree run: git ls-tree -r -t -l --full-name HEAD | sort -n -r -k 4 diff --git a/.github/workflows/job_cpu_functional_tests.yml b/.github/workflows/job_cpu_functional_tests.yml index f8a82031af6..0f94dd735bb 100644 --- a/.github/workflows/job_cpu_functional_tests.yml +++ b/.github/workflows/job_cpu_functional_tests.yml @@ -13,6 +13,8 @@ on: required: false default: null +permissions: read-all + jobs: CPU_Functional_Tests: name: CPU functional tests @@ -30,18 +32,14 @@ jobs: PARALLEL_TEST_SCRIPT: ${{ github.workspace }}/install/tests/functional_test_utils/layer_tests_summary/run_parallel.py PARALLEL_TEST_CACHE: ${{ github.workspace }}/install/tests/test_cache.lst steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -64,12 +62,8 @@ jobs: tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR popd - - name: Install OpenVINO dependencies (Linux) - if: runner.os == 'Linux' - run: $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -c=gpu -y - - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -87,7 +81,7 @@ jobs: run: python3 -m pip install -r ${INSTALL_TEST_DIR}/functional_test_utils/layer_tests_summary/requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@v4 + uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }} @@ -107,14 +101,14 @@ jobs: timeout-minutes: 25 - name: Save tests execution time - uses: actions/cache/save@v4 + uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 if: github.ref_name == 'master' with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }} - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: test-results-functional-cpu diff --git a/.github/workflows/job_cxx_unit_tests.yml b/.github/workflows/job_cxx_unit_tests.yml index 2b2dd9e7572..92c12dfcd71 100644 --- a/.github/workflows/job_cxx_unit_tests.yml +++ b/.github/workflows/job_cxx_unit_tests.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + jobs: CXX_Unit_Tests: name: C++ unit tests @@ -32,18 +34,14 @@ jobs: INSTALL_DIR: ${{ github.workspace }}/install INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -63,10 +61,6 @@ jobs: tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR popd - - name: Install OpenVINO dependencies (Linux) - if: runner.os == 'Linux' - run: $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -c=gpu -y - # # Tests # @@ -261,7 +255,7 @@ jobs: ${INSTALL_TEST_DIR}/ov_hetero_func_tests --gtest_print_time=1 --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OVHeteroFuncTests.xml --gtest_filter="*smoke*" - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-cpp diff --git a/.github/workflows/job_debian_packages.yml b/.github/workflows/job_debian_packages.yml index 77c03f3053e..d4734805a2c 100644 --- a/.github/workflows/job_debian_packages.yml +++ b/.github/workflows/job_debian_packages.yml @@ -13,6 +13,8 @@ on: required: false default: null +permissions: read-all + jobs: Debian_Packages: name: Debian Packages @@ -31,7 +33,7 @@ jobs: run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - name: Download OpenVINO debian packages - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_debian_packages path: ${{ env.DEBIAN_PACKAGES_DIR }} diff --git a/.github/workflows/job_gpu_tests.yml b/.github/workflows/job_gpu_tests.yml new file mode 100644 index 00000000000..7ba71afec09 --- /dev/null +++ b/.github/workflows/job_gpu_tests.yml @@ -0,0 +1,134 @@ +name: GPU + +on: + workflow_call: + inputs: + test_type: + description: 'Type of tests to execute' + type: string + required: true + device: + description: 'Device name (igpu or dgpu)' + type: string + required: true + runner: + description: 'Runner labels by which the runner will be chosen. Example: [ "self-hosted", "igpu" ]' + type: string + required: true + container: + description: 'JSON to be converted to the value of the "container" configuration for the job' + type: string + required: false + default: '{"image": null}' + +jobs: + GPU: + timeout-minutes: 80 + runs-on: ${{ fromJSON(inputs.runner) }} + container: ${{ fromJSON(inputs.container) }} + defaults: + run: + shell: bash + env: + DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input + INSTALL_DIR: ${{ github.workspace }}/install + INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests + GTEST_PARALLEL_SCRIPT: ${{ github.workspace }}/gtest_parallel.py + steps: + - name: Download OpenVINO package + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: 'openvino_package' + path: ${{ env.INSTALL_DIR }} + + - name: Download OpenVINO tests package + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: 'openvino_tests' + path: ${{ env.INSTALL_TEST_DIR }} + + # Needed as ${{ github.workspace }} is not working correctly when using Docker + - name: Setup Variables + run: | + echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV" + echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV" + echo "GTEST_PARALLEL_SCRIPT=$GITHUB_WORKSPACE/gtest_parallel.py" >> "$GITHUB_ENV" + + - name: Extract OpenVINO packages + run: | + pushd $INSTALL_DIR + tar -xzf openvino_package.tar.gz -C $INSTALL_DIR + popd + pushd $INSTALL_TEST_DIR + tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR + popd + + - name: Install dependencies (Linux) + run: | + $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -c=gpu -y + + apt-get update && apt-get install -y wget software-properties-common ca-certificates gpg-agent tzdata clinfo + env: + DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input + TZ: "Europe/London" # to prevent tzdata from waiting user input + - name: Setup Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Get gtest-parallel script + run: wget https://raw.githubusercontent.com/google/gtest-parallel/master/gtest_parallel.py + + - name: Install compute runtime drivers + run: | + wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15985.7/intel-igc-core_1.0.15985.7_amd64.deb + wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15985.7/intel-igc-opencl_1.0.15985.7_amd64.deb + wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-level-zero-gpu-dbgsym_1.3.28454.6_amd64.ddeb + wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-level-zero-gpu_1.3.28454.6_amd64.deb + wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-opencl-icd-dbgsym_24.05.28454.6_amd64.ddeb + wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-opencl-icd_24.05.28454.6_amd64.deb + wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/libigdgmm12_22.3.11_amd64.deb + dpkg -i *.deb + + - name: Install media & display runtimes + if: ${{ inputs.device == 'dgpu' }} + run: | + apt-get update && apt-get install -y \ + libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \ + libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm11 libxatracker2 mesa-va-drivers \ + mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all + + - name: Verify devices + run: clinfo + + # + # Tests + # + + - name: OpenVINO GPU ${{ inputs.test_type }} Tests + id: run_tests + run: | + source ${INSTALL_DIR}/setupvars.sh + + TEST_RESULTS_DIR="${{ inputs.device }}_${{ inputs.test_type }}_tests" + echo "test_results_dir=$TEST_RESULTS_DIR" >> $GITHUB_OUTPUT + + rm -rf ${INSTALL_TEST_DIR}/${TEST_RESULTS_DIR} && mkdir -p ${INSTALL_TEST_DIR}/${TEST_RESULTS_DIR} + + test_filter='' + if [[ "${{ inputs.test_type }}" == "unit" ]]; then + # Ticket: 138018 + test_filter='-*scatter_nd_update_gpu.dynamic_padded_output*:*border_gpu.basic_zero_input*:*bicubic_zeros_no_align_data1x1*:*bicubic_border_align_batches*:*bilinear_zeros_no_align_data1x1*:*non_zero_gpu.empty_input*:*mark_shape_of_subgraphs.concat_with_empty_tensor_inputs*:*concat_cpu_impl.dynamic_4d_f*:*border_gpu.basic_zero_input_dynamic*:*network_test.model_with_empty_input_is_not_dynamic*:*bicubic_zeros_align_data1x1*' + else + test_filter='*smoke*' + fi + python3 ${GTEST_PARALLEL_SCRIPT} ${INSTALL_TEST_DIR}/ov_gpu_${{ inputs.test_type }}_tests --dump_json_test_results=${INSTALL_TEST_DIR}/${TEST_RESULTS_DIR}/ov_gpu_${{ inputs.test_type }}_tests.json -- --report_unique_name --gtest_filter=$test_filter + + + - name: Upload Test Results + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + if: always() + with: + name: test-results-${{ inputs.test_type }}-${{ inputs.device }} + path: ${{ env.INSTALL_TEST_DIR }}/${{ steps.run_tests.outputs.test_results_dir }} + if-no-files-found: 'error' diff --git a/.github/workflows/job_onnx_models_tests.yml b/.github/workflows/job_onnx_models_tests.yml index 8da73268e00..30c226488fb 100644 --- a/.github/workflows/job_onnx_models_tests.yml +++ b/.github/workflows/job_onnx_models_tests.yml @@ -13,6 +13,8 @@ on: required: false default: '{"image": null}' +permissions: read-all + jobs: ONNX_Models_tests: name: ONNX Models tests @@ -35,18 +37,14 @@ jobs: ONNX_MODEL_ZOO_SHA: "5faef4c33eba0395177850e1e31c4a6a9e634c82" if: ${{ github.event_name != 'merge_group' }} steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -70,27 +68,14 @@ jobs: tar -xzf openvino_tests.tar.gz -C ${INSTALL_DIR} popd - - name: Fetch setup_python action and model_zoo_preprocess script - uses: actions/checkout@v4 + - name: Fetch model_zoo_preprocess script + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | - .github/actions/setup_python/action.yml src/frontends/onnx/tests/tests_python/model_zoo_preprocess.sh sparse-checkout-cone-mode: false path: 'openvino' - - name: Install dependencies - run: | - # install git (required to build pip deps from the sources) - apt-get update && apt-get install --assume-yes --no-install-recommends git ca-certificates git-lfs - - - name: Setup Python 3.11 - uses: ./openvino/.github/actions/setup_python - with: - version: '3.11' - should-setup-pip-paths: 'false' - self-hosted-runner: ${{ contains(inputs.runner, 'aks') }} - - name: Update Models run: bash ${OPENVINO_REPO}/src/frontends/onnx/tests/tests_python/model_zoo_preprocess.sh -d ${MODELS_SHARE_PATH} -o -s "${{ env.ONNX_MODEL_ZOO_SHA }}" diff --git a/.github/workflows/job_onnx_runtime.yml b/.github/workflows/job_onnx_runtime.yml index b1d7060b6bc..ae0f21bf58a 100644 --- a/.github/workflows/job_onnx_runtime.yml +++ b/.github/workflows/job_onnx_runtime.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + jobs: ONNX_Runtime: name: ONNX Runtime Integration @@ -41,7 +43,7 @@ jobs: ONNX_RUNTIME_BUILD_DIR: ${{ github.workspace }}/onnxruntime/build steps: - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} diff --git a/.github/workflows/job_openvino_js.yml b/.github/workflows/job_openvino_js.yml index b91a3d8bc93..a90bafd968d 100644 --- a/.github/workflows/job_openvino_js.yml +++ b/.github/workflows/job_openvino_js.yml @@ -13,6 +13,8 @@ on: required: false default: '{"image": null}' +permissions: read-all + jobs: JS_API: name: OpenVINO JS API @@ -29,7 +31,7 @@ jobs: NODE_VERSION: 20 steps: - name: Fetch OpenVINO JS sources - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | src/bindings/js @@ -42,13 +44,13 @@ jobs: echo "OPENVINO_JS_LIBS_DIR=$GITHUB_WORKSPACE/openvino/src/bindings/js/node/bin" >> "$GITHUB_ENV" - name: Download OpenVINO JS package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_js_package path: ${{ env.OPENVINO_JS_LIBS_DIR }} - name: Setup Node ${{ env.NODE_VERSION }} - uses: actions/setup-node@v4 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: ${{ env.NODE_VERSION }} diff --git a/.github/workflows/job_python_unit_tests.yml b/.github/workflows/job_python_unit_tests.yml index 4cd988ea66c..2348e64a78a 100644 --- a/.github/workflows/job_python_unit_tests.yml +++ b/.github/workflows/job_python_unit_tests.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -37,18 +39,15 @@ jobs: INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -70,12 +69,8 @@ jobs: tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR popd - - name: Install OpenVINO dependencies (Linux) - if: runner.os == 'Linux' - run: $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -y -c=gpu - - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -275,7 +270,7 @@ jobs: - name: Clone API snippets if: runner.os != 'macOS' - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: docs/snippets path: ${{ env.OPENVINO_REPO }} @@ -291,7 +286,7 @@ jobs: python3 ${OPENVINO_REPO}/docs/snippets/main.py - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-python diff --git a/.github/workflows/job_pytorch_models_tests.yml b/.github/workflows/job_pytorch_models_tests.yml index 16aa00873bc..6ebaaf183fe 100644 --- a/.github/workflows/job_pytorch_models_tests.yml +++ b/.github/workflows/job_pytorch_models_tests.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + jobs: PyTorch_Models_Tests: name: PyTorch Models tests @@ -47,19 +49,19 @@ jobs: fi - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tokenizers extension - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tokenizers_wheel path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -83,7 +85,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -140,18 +142,29 @@ jobs: USE_SYSTEM_CACHE: False OP_REPORT_FILE: ${{ env.INSTALL_TEST_DIR }}/TEST-torch_unsupported_ops.log + - name: PagedAttention Test + if: always() + run: | + export PYTHONPATH=${MODEL_HUB_TESTS_INSTALL_DIR}:$PYTHONPATH + python3 -m pytest ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/test_pa_transformation.py -m ${TYPE} --html=${INSTALL_TEST_DIR}/TEST-torch_pagedattention_tests.html --self-contained-html -v --tb=short + env: + TYPE: ${{ inputs.event == 'schedule' && 'nightly' || 'precommit'}} + TEST_DEVICE: CPU + USE_SYSTEM_CACHE: False + OP_REPORT_FILE: ${{ env.INSTALL_TEST_DIR }}/TEST-torch_unsupported_ops.log + - name: Reformat unsupported ops file if: '!cancelled()' run: | python3 ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/scripts/process_op_report.py ${INSTALL_TEST_DIR}/TEST-torch_unsupported_ops.log - + - name: Available storage after tests run: | echo "Available storage:" df -h - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-torch-models diff --git a/.github/workflows/job_samples_tests.yml b/.github/workflows/job_samples_tests.yml index 534ce33409c..ac2274d8415 100644 --- a/.github/workflows/job_samples_tests.yml +++ b/.github/workflows/job_samples_tests.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + jobs: Samples: runs-on: ${{ inputs.runner }} @@ -31,18 +33,14 @@ jobs: INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests BUILD_DIR: ${{ github.workspace }}/build steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -63,16 +61,12 @@ jobs: tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR popd - - name: Install OpenVINO dependencies (Linux) - if: runner.os == 'Linux' - run: $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -y - - name: Install OpenVINO dependencies (mac) if: runner.os == 'macOS' run: brew install coreutils - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -84,7 +78,6 @@ jobs: with: version: '3.11' should-setup-pip-paths: 'false' - self-hosted-runner: ${{ runner.os == 'Linux' }} - name: Build cpp samples - GCC run: $INSTALL_DIR/samples/cpp/build_samples.sh -i $INSTALL_DIR -b $BUILD_DIR/cpp_samples @@ -94,7 +87,7 @@ jobs: - name: Build cpp samples - Clang if: runner.os == 'Linux' run: | - apt-get install -y clang + apt-get update && apt-get install -y clang $INSTALL_DIR/samples/cpp/build_samples.sh -i $INSTALL_DIR -b $BUILD_DIR/cpp_samples_clang env: CMAKE_COMPILE_WARNING_AS_ERROR: 'ON' diff --git a/.github/workflows/job_tensorflow_layer_tests.yml b/.github/workflows/job_tensorflow_layer_tests.yml index bb2efa0eec6..e19e64d8aa0 100644 --- a/.github/workflows/job_tensorflow_layer_tests.yml +++ b/.github/workflows/job_tensorflow_layer_tests.yml @@ -21,6 +21,8 @@ on: type: string required: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -41,24 +43,20 @@ jobs: INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests steps: - - name: Set apt retries - if: runner.os == 'Linux' - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} - name: Download OpenVINO tokenizers extension - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tokenizers_wheel path: ${{ env.INSTALL_DIR }} @@ -92,12 +90,8 @@ jobs: Expand-Archive openvino_tests.zip -DestinationPath ${{ env.INSTALL_DIR }} popd - - name: Install OpenVINO dependencies (Linux) - if: runner.os == 'Linux' - run: $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -y -c=gpu - - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -164,7 +158,7 @@ jobs: TEST_PRECISION: FP16 - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-python-tf-layers diff --git a/.github/workflows/job_tensorflow_models_tests.yml b/.github/workflows/job_tensorflow_models_tests.yml index 2dd36814d9c..cf69d0c4f1d 100644 --- a/.github/workflows/job_tensorflow_models_tests.yml +++ b/.github/workflows/job_tensorflow_models_tests.yml @@ -17,6 +17,8 @@ on: type: string required: true +permissions: read-all + jobs: TensorFlow_Models_Tests: name: TensorFlow Models tests @@ -34,33 +36,20 @@ jobs: MODEL_HUB_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/model_hub_tests NUMBER_OF_REPLICAS: 2 steps: - - name: Check sudo - if: ${{ runner.os == 'Linux' }} - run: if [ "$(id -u)" -eq 0 ]; then apt update && apt --assume-yes install sudo; fi - - - name: Set apt retries - if: runner.os == 'Linux' - run: | - if [ "$(id -u)" -eq 0 ]; then - echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - else - sudo sh -c "echo 'Acquire::Retries \"10\";' >> /etc/apt/apt.conf.d/80-retries" - fi - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tokenizers extension - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tokenizers_wheel path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -88,19 +77,13 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml sparse-checkout-cone-mode: false path: 'openvino' - - name: Install dependencies - if: ${{ runner.os == 'Linux' }} - run: | - # install git (required to build pip deps from the sources) - sudo apt-get install --assume-yes --no-install-recommends g++ git ca-certificates wget - - name: Setup Python 3.11 uses: ./openvino/.github/actions/setup_python with: @@ -131,7 +114,7 @@ jobs: TEST_DEVICE: CPU - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-tensorflow-models-${{ inputs.model_scope }} diff --git a/.github/workflows/job_tokenizers.yml b/.github/workflows/job_tokenizers.yml index 5198ee5db99..bf3d650873f 100644 --- a/.github/workflows/job_tokenizers.yml +++ b/.github/workflows/job_tokenizers.yml @@ -21,6 +21,8 @@ on: type: string required: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -48,7 +50,7 @@ jobs: echo "EXTENSION_BUILD_DIR=$GITHUB_WORKSPACE/build" >> "$GITHUB_ENV" - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python @@ -56,7 +58,6 @@ jobs: install_build_dependencies.sh - name: Setup Python ${{ env.PYTHON_VERSION }} - if: ${{ runner.os != 'Linux' }} # We do not need to install Python on Linux as we use Docker with it installed uses: ./.github/actions/setup_python with: version: ${{ env.PYTHON_VERSION }} @@ -65,14 +66,14 @@ jobs: self-hosted-runner: ${{ runner.os == 'Linux' }} - name: Clone OpenVINO Tokenizers - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_tokenizers' path: ${{ env.OPENVINO_TOKENIZERS_REPO }} ref: 'master' - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} @@ -129,7 +130,7 @@ jobs: - name: Upload openvino tokenizers wheel if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tokenizers_wheel path: ${{ env.EXTENSION_BUILD_DIR }}/*.whl diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 3089268cdfd..c07df7494f7 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,6 +2,8 @@ name: "Pull Request Labeler" on: - pull_request_target +permissions: read-all + jobs: triage: permissions: @@ -9,20 +11,20 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: akladiev/labeler@v4.3.1 + - uses: akladiev/labeler@eeac5941e7fb6f980d47e038ac0665168851c874 # v4.3.1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: '.github/labeler.yml' sync-labels: 'true' dot: 'true' non-matching-label: 'no-match-files' - + external_pr_labeller: name: Label External PR runs-on: ubuntu-latest steps: - name: Checkout Labeller Script - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: '.github' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 008c68854ca..b3faeca641f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -16,6 +16,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux cancel-in-progress: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -29,7 +31,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -62,13 +64,15 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: ./.github/actions/handle_docker id: handle_docker with: images: | ov_build/ubuntu_20_04_x64 + ov_build/ubuntu_20_04_x64_nvidia + ov_test/ubuntu_20_04_x64 registry: 'openvinogithubactions.azurecr.io' dockerfiles_root_dir: '.github/dockerfiles' changed_components: ${{ needs.smart_ci.outputs.changed_components }} @@ -109,7 +113,7 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' @@ -124,7 +128,7 @@ jobs: git rev-parse HEAD - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} @@ -252,7 +256,7 @@ jobs: # Upload build artifacts and logs # - name: Upload build logs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: build_logs @@ -261,7 +265,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -269,7 +273,7 @@ jobs: - name: Upload openvino js package if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_js_package path: ${{ env.INSTALL_DIR_JS }} @@ -277,7 +281,7 @@ jobs: - name: Upload openvino developer package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_developer_package path: ${{ env.BUILD_DIR }}/openvino_developer_package.tar.gz @@ -285,7 +289,7 @@ jobs: - name: Upload openvino debian packages if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_debian_packages path: ${{ env.BUILD_DIR }}/*.deb @@ -293,7 +297,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -308,22 +312,22 @@ jobs: image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04' Samples: - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] if: fromJSON(needs.smart_ci.outputs.affected_components).samples uses: ./.github/workflows/job_samples_tests.yml with: runner: 'aks-linux-4-cores-16gb' - image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04' + image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_x64 }} affected-components: ${{ needs.smart_ci.outputs.affected_components }} JS_API: name: OpenVINO JS API - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API uses: ./.github/workflows/job_openvino_js.yml with: runner: 'aks-linux-4-cores-16gb' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04"}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}"}' Conformance: needs: [ Build, Smart_CI ] @@ -358,13 +362,13 @@ jobs: # - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -379,7 +383,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -423,7 +427,7 @@ jobs: - name: Upload Conformance Artifacts if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: conformance_artifacts_${{ matrix.TEST_TYPE }}-${{ env.TEST_DEVICE }} path: ${{ env.CONFORMANCE_ARTIFACTS_DIR }}/conformance_artifacts.tar.gz @@ -449,7 +453,7 @@ jobs: - name: Upload Conformance Artifacts if: ${{ matrix.TEST_TYPE == 'API' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: conformance_artifacts_${{ matrix.TEST_TYPE }}-TEMPLATE path: ${{ env.CONFORMANCE_ARTIFACTS_DIR }}/conformance_artifacts.tar.gz @@ -470,79 +474,79 @@ jobs: name: ONNX Models Tests if: fromJSON(needs.smart_ci.outputs.affected_components).Python_API.test || fromJSON(needs.smart_ci.outputs.affected_components).ONNX_FE.test - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_onnx_models_tests.yml with: - runner: 'aks-linux-16-cores-32gb' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + runner: 'aks-linux-16-cores-64gb' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' CXX_Unit_Tests: name: C++ unit tests - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_cxx_unit_tests.yml with: runner: 'aks-linux-4-cores-16gb' - image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04' + image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_x64 }} affected-components: ${{ needs.smart_ci.outputs.affected_components }} Python_Unit_Tests: name: Python unit tests - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_python_unit_tests.yml with: runner: 'aks-linux-4-cores-16gb' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} TensorFlow_Layer_Tests: name: TensorFlow Layer Tests - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ] uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'aks-linux-4-cores-16gb' shell: bash - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} CPU_Functional_Tests: name: CPU functional tests if: fromJSON(needs.smart_ci.outputs.affected_components).CPU.test - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_cpu_functional_tests.yml with: runner: 'aks-linux-8-cores-32gb' - image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04' + image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_x64 }} TensorFlow_Models_Tests_Precommit: name: TensorFlow Models tests if: fromJSON(needs.smart_ci.outputs.affected_components).TF_FE.test || fromJSON(needs.smart_ci.outputs.affected_components).TFL_FE.test - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ] uses: ./.github/workflows/job_tensorflow_models_tests.yml with: runner: 'aks-linux-8-cores-16gb' model_scope: 'precommit' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' TensorFlow_Models_Tests_Nightly_TF_HUB: name: TensorFlow TF Hub Models tests if: ${{ github.event_name == 'schedule' }} - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ] uses: ./.github/workflows/job_tensorflow_models_tests.yml with: - runner: 'aks-linux-8-cores-32gb' + runner: 'aks-linux-8-cores-64gb' model_scope: 'nightly_tf_hub' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' TensorFlow_Models_Tests_Nightly_HF: name: TensorFlow Hugging Face Models tests if: ${{ github.event_name == 'schedule' }} - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ] uses: ./.github/workflows/job_tensorflow_models_tests.yml with: - runner: 'aks-linux-8-cores-32gb' + runner: 'aks-linux-8-cores-64gb' model_scope: 'nightly_hf' - container: '{"image": "openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04", "volumes": ["/mount:/mount"]}' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64 }}", "volumes": ["/mount:/mount"]}' # TODO: Switch back to self-hosted runners # container: @@ -560,14 +564,14 @@ jobs: NVIDIA_Plugin: name: NVIDIA plugin - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] timeout-minutes: 15 defaults: run: shell: bash runs-on: aks-linux-16-cores-32gb container: - image: openvinogithubactions.azurecr.io/dockerhub/nvidia/cuda:11.8.0-runtime-ubuntu20.04 + image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_20_04_x64_nvidia }} volumes: - /mount:/mount options: -e SCCACHE_AZURE_BLOB_CONTAINER -e SCCACHE_AZURE_CONNECTION_STRING @@ -591,28 +595,14 @@ jobs: if: fromJSON(needs.smart_ci.outputs.affected_components).NVIDIA steps: - - name: Set apt retries - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - - name: Fetch install_build_dependencies.sh - uses: actions/checkout@v4 - with: - sparse-checkout: | - install_build_dependencies.sh - sparse-checkout-cone-mode: false - path: ${{ env.OPENVINO_REPO }} - - - name: Install Prerequisites - run: apt update && apt install -y git ca-certificates - - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO Developer package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_developer_package path: ${{ env.INSTALL_DIR }} @@ -628,44 +618,12 @@ jobs: popd - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} ref: 'master' - # - # Dependencies - # - - - name: Install build dependencies - run: | - ${OPENVINO_REPO}/install_build_dependencies.sh - apt -y --no-install-recommends install software-properties-common curl - - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.4 - with: - version: "v0.7.5" - - - name: Install CUDA - run: | - wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin - mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 - - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub - add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" - apt update - apt install -y \ - libcudnn8=8.9.4.*-1+cuda11.8 \ - libcudnn8-dev=8.9.4.*-1+cuda11.8 \ - libcudnn8-samples=8.9.4.*-1+cuda11.8 \ - cuda-runtime-11-8 \ - cuda-11-8 \ - libcutensor1=1.6.1.5-1 \ - libcutensor-dev=1.6.1.5-1 \ - cuda-drivers=520.61.05-1 - # # Build # @@ -694,119 +652,44 @@ jobs: affected-components: ${{ needs.smart_ci.outputs.affected_components }} if: fromJSON(needs.smart_ci.outputs.affected_components).TOKENIZERS - GPU: - name: GPU Tests + iGPU: + name: iGPU Tests needs: [ Build, Smart_CI ] - if: fromJSON(needs.smart_ci.outputs.affected_components).GPU - timeout-minutes: 80 - runs-on: [ self-hosted, gpu ] + uses: ./.github/workflows/job_gpu_tests.yml strategy: max-parallel: 2 fail-fast: false matrix: TEST_TYPE: ['unit', 'func'] - container: - image: ubuntu:20.04 - options: --device /dev/dri:/dev/dri --group-add 109 --group-add 44 - volumes: - - /dev/dri:/dev/dri - defaults: - run: - shell: bash - env: - DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input - INSTALL_DIR: ${{ github.workspace }}/install - INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests - GTEST_PARALLEL_SCRIPT: ${{ github.workspace }}/gtest_parallel.py - steps: - - name: Download OpenVINO package - uses: actions/download-artifact@v4 - with: - name: 'openvino_package' - path: ${{ env.INSTALL_DIR }} + with: + device: 'igpu' + test_type: ${{ matrix.TEST_TYPE }} + runner: "[ 'self-hosted', 'igpu' ]" + container: '{"image": "ubuntu:20.04", "volumes": ["/dev/dri:/dev/dri"], "options": "--group-add 109 --group-add 44 + --device /dev/dri:/dev/dri"}' + if: fromJSON(needs.smart_ci.outputs.affected_components).GPU - - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 - with: - name: 'openvino_tests' - path: ${{ env.INSTALL_TEST_DIR }} - - # Needed as ${{ github.workspace }} is not working correctly when using Docker - - name: Setup Variables - run: | - echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV" - echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV" - echo "GTEST_PARALLEL_SCRIPT=$GITHUB_WORKSPACE/gtest_parallel.py" >> "$GITHUB_ENV" - - - name: Extract OpenVINO packages - run: | - pushd $INSTALL_DIR - tar -xzf openvino_package.tar.gz -C $INSTALL_DIR - popd - pushd $INSTALL_TEST_DIR - tar -xzf openvino_tests.tar.gz -C $INSTALL_DIR - popd - - - name: Install dependencies (Linux) - run: | - $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -c=gpu -y - - apt-get update && apt-get install -y wget software-properties-common ca-certificates gpg-agent tzdata - env: - DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input - TZ: "Europe/London" # to prevent tzdata from waiting user input - - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Get gtest-parallel script - run: wget https://raw.githubusercontent.com/google/gtest-parallel/master/gtest_parallel.py - - - name: Install GPU Drivers - run: | - wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15985.7/intel-igc-core_1.0.15985.7_amd64.deb - wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.15985.7/intel-igc-opencl_1.0.15985.7_amd64.deb - wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-level-zero-gpu-dbgsym_1.3.28454.6_amd64.ddeb - wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-level-zero-gpu_1.3.28454.6_amd64.deb - wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-opencl-icd-dbgsym_24.05.28454.6_amd64.ddeb - wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/intel-opencl-icd_24.05.28454.6_amd64.deb - wget https://github.com/intel/compute-runtime/releases/download/24.05.28454.6/libigdgmm12_22.3.11_amd64.deb - dpkg -i *.deb - - # - # Tests - # - - - name: OpenVINO GPU ${{ matrix.TEST_TYPE }} Tests - run: | - source ${INSTALL_DIR}/setupvars.sh - - rm -rf ${INSTALL_TEST_DIR}/gpu_${{ matrix.TEST_TYPE }}_tests && mkdir -p ${INSTALL_TEST_DIR}/gpu_${{ matrix.TEST_TYPE }}_tests - - test_filter='' - if [[ "${{ matrix.TEST_TYPE }}" == "unit" ]]; then - # Ticket: 138018 - test_filter='-*scatter_nd_update_gpu.dynamic_padded_output*:*border_gpu.basic_zero_input*:*bicubic_zeros_no_align_data1x1*:*bicubic_border_align_batches*:*bilinear_zeros_no_align_data1x1*:*non_zero_gpu.empty_input*:*mark_shape_of_subgraphs.concat_with_empty_tensor_inputs*:*concat_cpu_impl.dynamic_4d_f*:*border_gpu.basic_zero_input_dynamic*:*network_test.model_with_empty_input_is_not_dynamic*:*bicubic_zeros_align_data1x1*' - else - test_filter='*smoke*' - fi - python3 ${GTEST_PARALLEL_SCRIPT} ${INSTALL_TEST_DIR}/ov_gpu_${{ matrix.TEST_TYPE }}_tests --dump_json_test_results=${INSTALL_TEST_DIR}/gpu_${{ matrix.TEST_TYPE }}_tests/ov_gpu_${{ matrix.TEST_TYPE }}_tests.json -- --report_unique_name --gtest_filter=$test_filter - - - - name: Upload Test Results - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-results-${{ matrix.TEST_TYPE }}-gpu - path: ${{ env.INSTALL_TEST_DIR }}/gpu_${{ matrix.TEST_TYPE }}_tests - if-no-files-found: 'error' + dGPU: + name: dGPU Tests + needs: [ Build, Smart_CI ] + uses: ./.github/workflows/job_gpu_tests.yml + strategy: + max-parallel: 2 + fail-fast: false + matrix: + TEST_TYPE: ['unit', 'func'] + with: + device: 'dgpu' + test_type: ${{ matrix.TEST_TYPE }} + runner: "[ 'self-hosted', 'dgpu' ]" + container: '{"image": "ubuntu:20.04", "volumes": ["/dev/dri:/dev/dri"], "options": "--group-add 109 --group-add 44 + --device /dev/dri/card0:/dev/dri/card0 --device /dev/dri/renderD128:/dev/dri/renderD128"}' + if: ${{ github.event_name == 'schedule' }} Overall_Status: name: ci/gha_overall_status needs: [Smart_CI, Build, Debian_Packages, Samples, Conformance, ONNX_Runtime, CXX_Unit_Tests, Python_Unit_Tests, TensorFlow_Layer_Tests, - CPU_Functional_Tests, TensorFlow_Models_Tests_Precommit, PyTorch_Models_Tests, NVIDIA_Plugin, Openvino_tokenizers, GPU] + CPU_Functional_Tests, TensorFlow_Models_Tests_Precommit, PyTorch_Models_Tests, NVIDIA_Plugin, Openvino_tokenizers, iGPU] if: ${{ always() }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml index 2d50900d157..95dab44352d 100644 --- a/.github/workflows/linux_arm64.yml +++ b/.github/workflows/linux_arm64.yml @@ -13,6 +13,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux-arm cancel-in-progress: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -26,7 +28,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -59,7 +61,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: ./.github/actions/handle_docker id: handle_docker @@ -106,13 +108,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} @@ -245,7 +247,7 @@ jobs: # Upload build artifacts and logs # - name: Upload build logs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: build_logs @@ -254,7 +256,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -262,7 +264,7 @@ jobs: - name: Upload openvino developer package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_developer_package path: ${{ env.BUILD_DIR }}/openvino_developer_package.tar.gz @@ -270,7 +272,7 @@ jobs: - name: Upload openvino js package if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_js_package path: ${{ env.INSTALL_DIR_JS }} @@ -278,7 +280,7 @@ jobs: - name: Upload openvino debian packages if: ${{ 'false' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_debian_packages path: ${{ env.BUILD_DIR }}/*.deb @@ -286,7 +288,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index bebf06fdb1d..8cee38b67e0 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -13,6 +13,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux-cc cancel-in-progress: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -26,7 +28,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -59,13 +61,14 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - uses: ./.github/actions/handle_docker id: handle_docker with: images: | ov_build/ubuntu_22_04_x64_cc + ov_test/ubuntu_22_04_x64 registry: 'openvinogithubactions.azurecr.io' dockerfiles_root_dir: '.github/dockerfiles' changed_components: ${{ needs.smart_ci.outputs.changed_components }} @@ -104,13 +107,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone test models - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/testdata' path: ${{ env.MODELS_PATH }} @@ -217,7 +220,7 @@ jobs: # Upload build artifacts and logs # - name: Upload build logs - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: build_logs @@ -226,7 +229,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -234,7 +237,7 @@ jobs: - name: Upload selective build statistics package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_selective_build_stat path: ${{ env.BUILD_DIR }}/openvino_selective_build_stat.tar.gz @@ -242,7 +245,7 @@ jobs: - name: Upload OpenVINO tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -276,13 +279,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone test models - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/testdata' path: ${{ env.MODELS_PATH }} @@ -290,7 +293,7 @@ jobs: ref: 'master' - name: Download selective build statistics package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_selective_build_stat path: ${{ env.SELECTIVE_BUILD_STAT_DIR }} @@ -333,11 +336,11 @@ jobs: CPU_Functional_Tests: name: CPU functional tests if: fromJSON(needs.smart_ci.outputs.affected_components).CPU.test - needs: [ Build, Smart_CI ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_cpu_functional_tests.yml with: runner: 'aks-linux-8-cores-32gb' - image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:22.04' + image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }} Overall_Status: name: ci/gha_overall_status_linux_cc diff --git a/.github/workflows/linux_riscv.yml b/.github/workflows/linux_riscv.yml index 6e63f2c44fa..bb5116df054 100644 --- a/.github/workflows/linux_riscv.yml +++ b/.github/workflows/linux_riscv.yml @@ -16,6 +16,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux-riscv cancel-in-progress: true +permissions: read-all + jobs: Smart_CI: runs-on: ubuntu-latest @@ -24,7 +26,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -75,7 +77,7 @@ jobs: run: apt-get update && apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' diff --git a/.github/workflows/linux_sanitizers.yml b/.github/workflows/linux_sanitizers.yml index 66d814c863a..1daecd00a48 100644 --- a/.github/workflows/linux_sanitizers.yml +++ b/.github/workflows/linux_sanitizers.yml @@ -11,6 +11,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux-sanitizers cancel-in-progress: true +permissions: read-all + env: PIP_CACHE_PATH: /mount/caches/pip/linux PYTHON_VERSION: '3.11' @@ -62,13 +64,13 @@ jobs: apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} @@ -184,7 +186,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package_${{ matrix.SANITIZER }} path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -192,7 +194,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests_${{ matrix.SANITIZER }} path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -228,13 +230,13 @@ jobs: run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: ${{ format('openvino_package_{0}', matrix.SANITIZER) }} path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: ${{ format('openvino_tests_{0}', matrix.SANITIZER) }} path: ${{ env.INSTALL_TEST_DIR }} @@ -264,7 +266,7 @@ jobs: apt update && apt --assume-yes install clang lld - name: Fetch Sanitizer Suppression Lists - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | tests/lsan/suppressions.txt @@ -401,7 +403,7 @@ jobs: --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OpImplTests.xml - name: AUTO unit tests - if: ${{ 'false' }} # Ticket: 134423 + if: always() run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_auto_unit_tests --gtest_print_time=1 \ @@ -460,7 +462,7 @@ jobs: ${INSTALL_TEST_DIR}/ov_hetero_func_tests --gtest_print_time=1 --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OVHeteroFuncTests.xml --gtest_filter="*smoke*" - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-cpp diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 28e03288dab..2c2f445fc5c 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -29,11 +29,12 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-mac-main cancel-in-progress: true +permissions: read-all + env: PYTHON_VERSION: '3.11' jobs: - Smart_CI: runs-on: ubuntu-latest outputs: @@ -41,7 +42,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -79,13 +80,13 @@ jobs: BUILD_DIR: ${{ github.workspace }}/build steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' @@ -130,7 +131,7 @@ jobs: # - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13 with: max-size: "2000M" # Should save cache only if run in the master branch of the base repo @@ -203,7 +204,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -211,7 +212,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -219,7 +220,7 @@ jobs: - name: Upload openvino js package if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_js_package path: ${{ env.INSTALL_DIR_JS }} diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml index 37dc330eafd..8d51e8ae34b 100644 --- a/.github/workflows/mac_arm64.yml +++ b/.github/workflows/mac_arm64.yml @@ -29,6 +29,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-mac-arm64 cancel-in-progress: true +permissions: read-all + env: PYTHON_VERSION: '3.11' @@ -40,7 +42,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -78,13 +80,13 @@ jobs: BUILD_DIR: ${{ github.workspace }}/build steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' @@ -129,7 +131,7 @@ jobs: # - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13 with: max-size: "2000M" # Should save cache only if run in the master branch of the base repo @@ -202,7 +204,7 @@ jobs: - name: Upload openvino package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.tar.gz @@ -210,7 +212,7 @@ jobs: - name: Upload openvino tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz @@ -218,7 +220,7 @@ jobs: - name: Upload openvino js package if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_js_package path: ${{ env.INSTALL_DIR_JS }} diff --git a/.github/workflows/mo.yml b/.github/workflows/mo.yml index b59df07a21b..f8318f1a691 100644 --- a/.github/workflows/mo.yml +++ b/.github/workflows/mo.yml @@ -16,20 +16,22 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: Pylint-UT: runs-on: ubuntu-22.04 steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.10' - name: Cache pip - uses: actions/cache@v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('tools/mo/requirements*.txt') }} @@ -53,4 +55,4 @@ jobs: - name: Pylint-MO run: pylint -d C,R,W openvino/tools/mo - working-directory: tools/mo \ No newline at end of file + working-directory: tools/mo diff --git a/.github/workflows/ovc.yml b/.github/workflows/ovc.yml index 886ed96f948..25c1f4c738b 100644 --- a/.github/workflows/ovc.yml +++ b/.github/workflows/ovc.yml @@ -11,20 +11,22 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: Pylint-UT: runs-on: ubuntu-22.04 steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.10' - name: Cache pip - uses: actions/cache@v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('src/bindings/python/requirements*.txt') }} diff --git a/.github/workflows/py_checks.yml b/.github/workflows/py_checks.yml index b4a361c0e55..5766105f164 100644 --- a/.github/workflows/py_checks.yml +++ b/.github/workflows/py_checks.yml @@ -20,15 +20,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: read-all + jobs: linters: runs-on: ubuntu-20.04 steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.8' @@ -47,7 +49,7 @@ jobs: git diff > samples_diff.diff working-directory: samples/python - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: failure() with: name: samples_diff @@ -65,7 +67,7 @@ jobs: git diff > pyopenvino_diff.diff working-directory: src/bindings/python/src/openvino - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: failure() with: name: pyopenvino_diff @@ -83,7 +85,7 @@ jobs: git diff > wheel_diff.diff working-directory: src/bindings/python/wheel - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: failure() with: name: wheel_diff @@ -111,4 +113,3 @@ jobs: fi fi done - diff --git a/.github/workflows/send_workflows_to_opentelemetry.yml b/.github/workflows/send_workflows_to_opentelemetry.yml index df77a74ce0d..c52b20bdcfd 100644 --- a/.github/workflows/send_workflows_to_opentelemetry.yml +++ b/.github/workflows/send_workflows_to_opentelemetry.yml @@ -35,7 +35,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: '.github' diff --git a/.github/workflows/stale_prs_and_issues.yml b/.github/workflows/stale_prs_and_issues.yml index deaf6278184..395fc6a350e 100644 --- a/.github/workflows/stale_prs_and_issues.yml +++ b/.github/workflows/stale_prs_and_issues.yml @@ -4,15 +4,16 @@ on: schedule: - cron: '0 0 * * *' -permissions: - issues: write - pull-requests: write +permissions: read-all jobs: stale: + permissions: + issues: write + pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: stale-issue-message: 'This issue will be closed in a week because of 9 months of no activity.' stale-pr-message: 'This PR will be closed in a week because of 2 weeks of no activity.' diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml index 250b9f549a6..f14b7de568c 100644 --- a/.github/workflows/webassembly.yml +++ b/.github/workflows/webassembly.yml @@ -13,6 +13,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-webassembly cancel-in-progress: true +permissions: read-all + jobs: Smart_CI: runs-on: ubuntu-latest @@ -21,7 +23,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -64,13 +66,13 @@ jobs: run: apt-get update && apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.4 + uses: mozilla-actions/sccache-action@2e7f9ec7921547d4b46598398ca573513895d0bd # v0.0.4 with: version: "v0.7.5" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7b0f4ad976e..460bff4db18 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,6 +16,8 @@ env: PIP_CACHE_PATH: /mount/caches/pip/win PYTHON_VERSION: '3.11' +permissions: read-all + jobs: Smart_CI: runs-on: ubuntu-latest @@ -24,7 +26,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -67,13 +69,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' @@ -150,7 +152,9 @@ jobs: ${{ runner.os }}-${{ runner.arch }}-ccache - name: Configure Developer Command Prompt for Microsoft Visual C++ - uses: ilammy/msvc-dev-cmd@v1 + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + toolset: 14.40 - name: Set SSL_CERT_FILE for model downloading for unit tests run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV @@ -215,14 +219,14 @@ jobs: # - name: Upload openvino package - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_package path: ${{ env.BUILD_DIR }}/openvino_package.zip if-no-files-found: 'error' - name: Upload openvino tests package - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.zip @@ -230,7 +234,7 @@ jobs: - name: Upload openvino js package if: fromJSON(needs.smart_ci.outputs.affected_components).JS_API - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_js_package path: ${{ env.INSTALL_DIR_JS }} @@ -253,13 +257,13 @@ jobs: steps: - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -274,7 +278,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -339,20 +343,20 @@ jobs: steps: - name: Fetch OpenVINO JS sources - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | src/bindings/js path: 'openvino' - name: Download OpenVINO js package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_js_package path: ${{ env.OPENVINO_JS_LIBS_DIR }} - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: 20 @@ -405,13 +409,13 @@ jobs: steps: - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -426,7 +430,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -563,7 +567,7 @@ jobs: run: python3 -m pytest -s ${{ env.INSTALL_TEST_DIR }}/ovc/unit_tests --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-OpenVinoConversion.xml - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-python @@ -593,13 +597,13 @@ jobs: steps: - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -769,7 +773,7 @@ jobs: ${{ env.INSTALL_TEST_DIR }}/ov_hetero_func_tests --gtest_print_time=1 --gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-OVHeteroFuncTests.xml --gtest_filter="*smoke*" - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-cpp @@ -793,13 +797,13 @@ jobs: if: fromJSON(needs.smart_ci.outputs.affected_components).CPU.test steps: - name: Download OpenVINO package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_package path: ${{ env.INSTALL_DIR }} - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -814,7 +818,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -832,7 +836,7 @@ jobs: run: python3 -m pip install -r ${{ github.workspace }}\install\tests\functional_test_utils\layer_tests_summary\requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@v4 + uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-tests-functional-cpu-stamp-${{ github.sha }} @@ -846,14 +850,14 @@ jobs: timeout-minutes: 60 - name: Save tests execution time - uses: actions/cache/save@v4 + uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 if: github.ref_name == 'master' with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-tests-functional-cpu-stamp-${{ github.sha }} - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-functional-cpu diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 4b77934694c..182f5883bd1 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -16,6 +16,8 @@ concurrency: group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-windows-cc cancel-in-progress: true +permissions: read-all + env: PYTHON_VERSION: '3.11' @@ -27,7 +29,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: .github/actions/smart-ci @@ -50,7 +52,7 @@ jobs: defaults: run: shell: pwsh - runs-on: aks-win-8-cores-64gb + runs-on: aks-win-32-cores-128gb env: CMAKE_BUILD_TYPE: 'Release' CMAKE_GENERATOR: 'Ninja Multi-Config' @@ -70,13 +72,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Clone test models - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/testdata' path: 'testdata' @@ -149,7 +151,9 @@ jobs: ${{ runner.os }}-${{ runner.arch }}-ccache - name: Configure Developer Command Prompt for Microsoft Visual C++ - uses: ilammy/msvc-dev-cmd@v1 + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + toolset: 14.40 - name: Set SSL_CERT_FILE for model downloading for unit tests run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV @@ -172,10 +176,11 @@ jobs: - name: Clean ccache stats run: '& ccache --zero-stats' + # If the build fails due to running out of RAM, please decrease the number of parallel jobs (--parallel n) - name: Cmake build - CC COLLECT run: | - cmake --build ${{ env.BUILD_DIR }} --parallel 8 --config ${{ env.CMAKE_BUILD_TYPE }} && ` - cmake --build ${{ env.BUILD_DIR }} --parallel 8 --config ${{ env.CMAKE_BUILD_TYPE }} --target sea_itt_lib + cmake --build ${{ env.BUILD_DIR }} --parallel 16 --config ${{ env.CMAKE_BUILD_TYPE }} && ` + cmake --build ${{ env.BUILD_DIR }} --parallel 16 --config ${{ env.CMAKE_BUILD_TYPE }} --target sea_itt_lib - name: Show ccache stats run: '& ccache --show-stats' @@ -242,7 +247,7 @@ jobs: - name: Upload selective build statistics package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_selective_build_stat path: ${{ env.BUILD_DIR }}/openvino_selective_build_stat.zip @@ -250,7 +255,7 @@ jobs: - name: Upload OpenVINO tests package if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: openvino_tests path: ${{ env.BUILD_DIR }}/openvino_tests.zip @@ -262,7 +267,7 @@ jobs: defaults: run: shell: pwsh - runs-on: aks-win-8-cores-64gb + runs-on: aks-win-32-cores-128gb env: CMAKE_BUILD_TYPE: 'Release' OPENVINO_REPO: "${{ github.workspace }}\\openvino" @@ -273,13 +278,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: path: 'openvino' submodules: 'true' - name: Clone test models - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: 'openvinotoolkit/testdata' path: 'testdata' @@ -287,7 +292,7 @@ jobs: ref: 'master' - name: Download selective build statistics package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_selective_build_stat path: ${{ env.SELECTIVE_BUILD_STAT_DIR }} @@ -349,7 +354,7 @@ jobs: steps: - name: Download OpenVINO tests package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} @@ -358,7 +363,7 @@ jobs: run: Expand-Archive ${{ env.INSTALL_TEST_DIR }}/openvino_tests.zip -DestinationPath "${{ env.INSTALL_TEST_DIR }}" - name: Fetch setup_python action - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -376,7 +381,7 @@ jobs: run: python3 -m pip install -r ${{ env.INSTALL_TEST_DIR }}/layer_tests_summary/requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@v4 + uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-tests-functional-cpu-stamp-${{ github.sha }} @@ -391,7 +396,7 @@ jobs: timeout-minutes: 60 - name: Upload Test Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ !cancelled() }} with: name: test-results-functional-cpu diff --git a/.github/workflows/workflow_rerunner.yml b/.github/workflows/workflow_rerunner.yml index 08215bea254..bb8ddfd6e64 100644 --- a/.github/workflows/workflow_rerunner.yml +++ b/.github/workflows/workflow_rerunner.yml @@ -16,6 +16,8 @@ on: - '.github/workflows/workflow_rerunner.yml' - '.github/scripts/workflow_rerun/**' +permissions: read-all + jobs: rerun: name: Rerun Workflow @@ -28,7 +30,7 @@ jobs: checks: read steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: '.github/scripts/workflow_rerun' @@ -59,7 +61,7 @@ jobs: runs-on: aks-linux-2-cores-8gb steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: sparse-checkout: '.github/scripts/workflow_rerun' lfs: true diff --git a/cmake/developer_package/ncc_naming_style/openvino.style b/cmake/developer_package/ncc_naming_style/openvino.style index 141f02b9ab5..8bfa4164490 100644 --- a/cmake/developer_package/ncc_naming_style/openvino.style +++ b/cmake/developer_package/ncc_naming_style/openvino.style @@ -1,6 +1,6 @@ # custom OpenVINO values CppMethod: '^(operator\W+|[a-z_\d]+|signaling_NaN|quiet_NaN|OPENVINO_OP)$' -ClassName: '^([A-Z][\w]+|b?float16|float8_e4m3|float8_e5m2|numeric_limits|ngraph_error|stopwatch|unsupported_op)$' +ClassName: '^([A-Z][\w]+|b?float16|float8_e4m3|float8_e5m2|float4_e2m1|numeric_limits|ngraph_error|stopwatch|unsupported_op)$' StructName: '^([A-Z][\w]+|element_type_traits|hash|oi_pair|stat)$' FunctionName: '^(operator\W+|[a-z_\d]+)|PrintTo$' Namespace: '^([a-z\d_]*|InferenceEngine)$' @@ -18,7 +18,7 @@ VariableReference: '^\w+$' EnumName: '^[A-Z][\w]+$' # excepts element_type -EnumConstantName: '^([A-Z\d_]+|undefined|dynamic|boolean|bf16|f16|f32|f64|i4|i8|i16|i32|i64|u1|u2|u3|u4|u6|u8|u16|u32|u64|nf4|f8e4m3|f8e5m2|string|asymmetric|align_corners|round_prefer_floor|round_prefer_ceil|floor|ceil|simple|nearest|linear|linear_onnx|cubic|area|scales|sizes|half_pixel|tf_half_pixel_for_nn|pytorch_half_pixel|asymetric)$' +EnumConstantName: '^([A-Z\d_]+|undefined|dynamic|boolean|bf16|f16|f32|f64|i4|i8|i16|i32|i64|u1|u2|u3|u4|u6|u8|u16|u32|u64|nf4|f8e4m3|f8e5m2|f4e2m1|string|asymmetric|align_corners|round_prefer_floor|round_prefer_ceil|floor|ceil|simple|nearest|linear|linear_onnx|cubic|area|scales|sizes|half_pixel|tf_half_pixel_for_nn|pytorch_half_pixel|asymetric)$' # TODO: align UsingDeclaration: '^.*$' TypedefName: '^.*$' diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 8b57988ca14..797c95ef7d9 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -33,6 +33,7 @@ function(build_docs) set(DOXYGEN_MAPPING_SCRIPT "${SCRIPTS_DIR}/create_mapping.py") set(DOCS_MAPPING_SCRIPT "${SCRIPTS_DIR}/create_doc_mapping.py") set(BREATHE_APIDOC_SCRIPT "${SCRIPTS_DIR}/apidoc.py") + set(OV_INSTALLATION_SCRIPT "${SCRIPTS_DIR}/install_appropriate_openvino_version.py") # Doxygen/Sphinx setup set(DOXYGEN_XML_OUTPUT "${DOCS_BUILD_DIR}/xml") @@ -62,7 +63,9 @@ function(build_docs) if(${ENABLE_PYTHON_API}) list(APPEND commands COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "STARTED preprocessing OpenVINO Python API") - list(APPEND commands COMMAND ${Python3_EXECUTABLE} -m pip install openvino) + list(APPEND commands COMMAND ${Python3_EXECUTABLE} ${OV_INSTALLATION_SCRIPT} + --ov_dir=${SPHINX_SETUP_DIR} + --python=${Python3_EXECUTABLE}) list(APPEND commands COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "FINISHED preprocessing OpenVINO Python API") endif() diff --git a/docs/articles_en/about-openvino/performance-benchmarks.rst b/docs/articles_en/about-openvino/performance-benchmarks.rst index bb874ea4593..39f22b5894d 100644 --- a/docs/articles_en/about-openvino/performance-benchmarks.rst +++ b/docs/articles_en/about-openvino/performance-benchmarks.rst @@ -1,5 +1,3 @@ -.. {#openvino_docs_performance_benchmarks} - Performance Benchmarks ====================== @@ -12,6 +10,7 @@ Performance Benchmarks :maxdepth: 1 :hidden: + performance-benchmarks/generativeAI-benchmarks performance-benchmarks/performance-benchmarks-faq OpenVINO Accuracy performance-benchmarks/getting-performance-numbers @@ -23,6 +22,8 @@ and :doc:`OpenVINO Model Server <../ovms_what_is_openvino_model_server>`, for a selection of public neural networks and Intel® devices. The results may help you decide which hardware to use in your applications or plan AI workload for the hardware you have already implemented in your solutions. Click the buttons below to see the chosen benchmark data. +For more detailed view of performance numbers for generative AI models, check the +:doc:`Generative AI Benchmark Results <./performance-benchmarks/generativeAI-benchmarks>` .. grid:: 1 1 2 2 :gutter: 4 diff --git a/docs/articles_en/about-openvino/performance-benchmarks/generativeAI-benchmarks.rst b/docs/articles_en/about-openvino/performance-benchmarks/generativeAI-benchmarks.rst new file mode 100644 index 00000000000..3c6365e56b2 --- /dev/null +++ b/docs/articles_en/about-openvino/performance-benchmarks/generativeAI-benchmarks.rst @@ -0,0 +1,8 @@ +Generative AI Benchmark Results +=================================== + +This page will give you a detailed information on how OpenVINO performs running a selection of +Generative AI models. + + + diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_01.png b/docs/articles_en/assets/images/home_begin_tile_01.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_01.png rename to docs/articles_en/assets/images/home_begin_tile_01.png diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_02.png b/docs/articles_en/assets/images/home_begin_tile_02.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_02.png rename to docs/articles_en/assets/images/home_begin_tile_02.png diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_03.png b/docs/articles_en/assets/images/home_begin_tile_03.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_03.png rename to docs/articles_en/assets/images/home_begin_tile_03.png diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_04.png b/docs/articles_en/assets/images/home_begin_tile_04.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_04.png rename to docs/articles_en/assets/images/home_begin_tile_04.png diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_05.png b/docs/articles_en/assets/images/home_begin_tile_05.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_05.png rename to docs/articles_en/assets/images/home_begin_tile_05.png diff --git a/docs/sphinx_setup/_static/images/home_begin_tile_06.png b/docs/articles_en/assets/images/home_begin_tile_06.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_begin_tile_06.png rename to docs/articles_en/assets/images/home_begin_tile_06.png diff --git a/docs/sphinx_setup/_static/images/home_key_feature_01.png b/docs/articles_en/assets/images/home_key_feature_01.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_key_feature_01.png rename to docs/articles_en/assets/images/home_key_feature_01.png diff --git a/docs/sphinx_setup/_static/images/home_key_feature_02.png b/docs/articles_en/assets/images/home_key_feature_02.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_key_feature_02.png rename to docs/articles_en/assets/images/home_key_feature_02.png diff --git a/docs/sphinx_setup/_static/images/home_key_feature_03.png b/docs/articles_en/assets/images/home_key_feature_03.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_key_feature_03.png rename to docs/articles_en/assets/images/home_key_feature_03.png diff --git a/docs/sphinx_setup/_static/images/home_key_feature_04.png b/docs/articles_en/assets/images/home_key_feature_04.png similarity index 100% rename from docs/sphinx_setup/_static/images/home_key_feature_04.png rename to docs/articles_en/assets/images/home_key_feature_04.png diff --git a/docs/sphinx_setup/_static/images/openvino-overview-diagram.jpg b/docs/articles_en/assets/images/openvino-overview-diagram.jpg similarity index 100% rename from docs/sphinx_setup/_static/images/openvino-overview-diagram.jpg rename to docs/articles_en/assets/images/openvino-overview-diagram.jpg diff --git a/docs/articles_en/assets/images/optional.png b/docs/articles_en/assets/images/optional.png new file mode 100644 index 00000000000..2c77f9288d4 --- /dev/null +++ b/docs/articles_en/assets/images/optional.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b78713020891a6655e3860338b7db430840560d8f2860162eca3d00b84533f24 +size 36362 diff --git a/docs/articles_en/assets/images/or-branches.png b/docs/articles_en/assets/images/or-branches.png new file mode 100644 index 00000000000..c71766873ae --- /dev/null +++ b/docs/articles_en/assets/images/or-branches.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:353c5b7f35a8f9f6c2c3074485a5a4e51f8c6ee776214444666da4037cc44832 +size 45347 diff --git a/docs/articles_en/assets/images/or_branches.png b/docs/articles_en/assets/images/or_branches.png new file mode 100644 index 00000000000..765b0622eeb --- /dev/null +++ b/docs/articles_en/assets/images/or_branches.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:696672a8c38260147f2fa68d266866ab4390ef919fa092cea1149b0eb529c68e +size 58557 diff --git a/docs/articles_en/assets/images/python-api.png b/docs/articles_en/assets/images/python-api.png new file mode 100644 index 00000000000..191ff8bace1 --- /dev/null +++ b/docs/articles_en/assets/images/python-api.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d378718b968f6a40555b31bf54af83fac978c3bfc07e234f9b1370229222cccd +size 31092 diff --git a/docs/articles_en/assets/images/simple_pattern_example.png b/docs/articles_en/assets/images/simple_pattern_example.png new file mode 100644 index 00000000000..b9fb29d34f6 --- /dev/null +++ b/docs/articles_en/assets/images/simple_pattern_example.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b3511899521a49c1bfdc569e16b8ad1e12157fe107d2b86d25ee04ff67a85b2 +size 43066 diff --git a/docs/articles_en/assets/snippets/multi_threading.py b/docs/articles_en/assets/snippets/multi_threading.py index 9a5baa1e757..edefa760318 100644 --- a/docs/articles_en/assets/snippets/multi_threading.py +++ b/docs/articles_en/assets/snippets/multi_threading.py @@ -37,7 +37,7 @@ compiled_model_3 = core.compile_model( # ! [ov:intel_cpu:multi_threading:part0] # ! [ov:intel_cpu:multi_threading:part1] -# Disable CPU threads pinning for inference when system supoprt it +# Disable CPU thread pinning for inference when the system supports it compiled_model_4 = core.compile_model( model=model, device_name=device_name, diff --git a/docs/articles_en/assets/snippets/ov_model_snippets.cpp b/docs/articles_en/assets/snippets/ov_model_snippets.cpp index 0ca99b76564..31ba0bc8028 100644 --- a/docs/articles_en/assets/snippets/ov_model_snippets.cpp +++ b/docs/articles_en/assets/snippets/ov_model_snippets.cpp @@ -171,8 +171,8 @@ if (m->match(node->output(0))) { bool openvino_api_examples(std::shared_ptr node) { { // ! [ov:ports_example] -// Let's suppose that node is opset8::Convolution operation -// as we know opset8::Convolution has two input ports (data, weights) and one output port +// Let's suppose that node is of ov::op::v0::Convolution type. +// As we know ov::op::v0::Convolution has two input ports (data, weights) and one output port. ov::Input data = node->input(0); ov::Input weights = node->input(1); ov::Output output = node->output(0); @@ -181,7 +181,7 @@ ov::Output output = node->output(0); auto pshape = data.get_partial_shape(); auto el_type = data.get_element_type(); -// Getting parent for input port +// Getting parent for input port i.e. Output mapped by the input ov::Output parent_output; parent_output = data.get_source_output(); @@ -216,15 +216,15 @@ return true; // ! [ov:replace_node] bool ov_replace_node(std::shared_ptr node) { - // Step 1. Verify that node has opset8::Negative type - auto neg = std::dynamic_pointer_cast(node); + // Step 1. Verify that node is of type ov::op::v0::Negative + auto neg = std::dynamic_pointer_cast(node); if (!neg) { return false; } - // Step 2. Create opset8::Multiply operation where the first input is negative operation input and second as Constant with -1 value - auto mul = std::make_shared(neg->input_value(0), - ov::opset8::Constant::create(neg->get_element_type(), ov::Shape{1}, {-1})); + // Step 2. Create ov::op::v1::Multiply operation with the first input being the output going into Negative and second as Constant with -1 value + auto mul = std::make_shared(neg->input_value(0), + ov::op::v0::Constant::create(neg->get_element_type(), ov::Shape{1}, {-1})); mul->set_friendly_name(neg->get_friendly_name()); ov::copy_runtime_info(neg, mul); @@ -233,18 +233,18 @@ bool ov_replace_node(std::shared_ptr node) { ov::replace_node(neg, mul); return true; - // Step 4. Negative operation will be removed automatically because all consumers was moved to Multiply operation + // Step 4. Negative operation will be removed automatically because all consumers were moved to Multiply operation } // ! [ov:replace_node] bool ov_manual_replace_node(std::shared_ptr node) { -auto neg = std::dynamic_pointer_cast(node); +auto neg = std::dynamic_pointer_cast(node); if (!neg) { return false; } -auto mul = std::make_shared(neg->input_value(0), - ov::opset8::Constant::create(neg->get_element_type(), ov::Shape{1}, {-1})); +auto mul = std::make_shared(neg->input_value(0), + ov::op::v0::Constant::create(neg->get_element_type(), ov::Shape{1}, {-1})); mul->set_friendly_name(neg->get_friendly_name()); ov::copy_runtime_info(neg, mul); @@ -262,8 +262,8 @@ void insert_example(std::shared_ptr node) { // Get all consumers for node auto consumers = node->output(0).get_target_inputs(); - // Step 2. Create new node. Let it be opset8::Relu. - auto new_node = std::make_shared(node); + // Step 2. Create new node ov::op::v0::Relu. + auto new_node = std::make_shared(node); // Step 3. Reconnect all consumers to new_node for (auto input : consumers) { @@ -277,7 +277,7 @@ void insert_example_with_copy(std::shared_ptr node) { // Make a node copy auto node_copy = node->clone_with_new_inputs(node->input_values()); // Create new node - auto new_node = std::make_shared(node_copy); + auto new_node = std::make_shared(node_copy); ov::replace_node(node, new_node); } // ! [ov:insert_node_with_copy] @@ -290,12 +290,12 @@ bool success = ov::replace_output_update_name(node->output(0), node->input_value } void replace_friendly_name() { -auto div = std::make_shared(); +auto div = std::make_shared(); // ! [ov:replace_friendly_name] // Replace Div operation with Power and Multiply sub-graph and set original friendly name to Multiply operation -auto pow = std::make_shared(div->input(1).get_source_output(), +auto pow = std::make_shared(div->input(1).get_source_output(), ov::op::v0::Constant::create(div->get_input_element_type(1), ov::Shape{1}, {-1})); -auto mul = std::make_shared(div->input(0).get_source_output(), pow); +auto mul = std::make_shared(div->input(0).get_source_output(), pow); mul->set_friendly_name(div->get_friendly_name()); ov::replace_node(div, mul); // ! [ov:replace_friendly_name] @@ -304,10 +304,10 @@ ov::replace_node(div, mul); void constant_subgraph() { // ! [ov:constant_subgraph] // After ConstantFolding pass Power will be replaced with Constant -auto input = std::make_shared(ov::element::f32, ov::Shape{1}); -auto pow = std::make_shared(ov::opset8::Constant::create(ov::element::f32, ov::Shape{1}, {2}), - ov::opset8::Constant::create(ov::element::f32, ov::Shape{1}, {3})); -auto mul = std::make_shared(input /* not constant input */, pow); +auto input = std::make_shared(ov::element::f32, ov::Shape{1}); +auto pow = std::make_shared(ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1}, {2}), + ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1}, {3})); +auto mul = std::make_shared(input /* not constant input */, pow); // ! [ov:constant_subgraph] } diff --git a/docs/articles_en/assets/snippets/ov_patterns.cpp b/docs/articles_en/assets/snippets/ov_patterns.cpp new file mode 100644 index 00000000000..8f3f3fd053a --- /dev/null +++ b/docs/articles_en/assets/snippets/ov_patterns.cpp @@ -0,0 +1,251 @@ +// Copyright (C) 2018-2024 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +// ! [ov::imports] +#include + +#include "common_test_utils/matcher.hpp" +#include "openvino/op/abs.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/matmul.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/relu.hpp" +#include "openvino/op/sigmoid.hpp" +#include "openvino/pass/pattern/op/optional.hpp" +#include "openvino/pass/pattern/op/or.hpp" +#include "openvino/pass/pattern/op/wrap_type.hpp" +#include "transformations/utils/utils.hpp" + +using namespace ov; +using namespace ov::pass; +using namespace std; +// ! [ov::imports] + +// ! [ov:create_simple_model_and_pattern] +TEST(pattern, simple_model_and_pattern) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a sample model + auto pattern_mul = std::make_shared(pattern::any_input(), pattern::any_input(), false, false); + auto pattern_abs = std::make_shared(pattern_mul->output(0)); + auto pattern_relu = std::make_shared(pattern_abs->output(0)); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // Should perfectly match + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); +} +// ! [ov:create_simple_model_and_pattern] + + +// ! [ov:create_simple_model_and_pattern_wrap_type] +TEST(pattern, simple_model_and_pattern_wrap_type) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a sample model + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // Should perfectly match + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); +} +// ! [ov:create_simple_model_and_pattern_wrap_type] + + +// ! [ov:wrap_type_list] +TEST(pattern, wrap_type_list) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + auto model_sig = std::make_shared(model_abs->output(0)); + auto model_result1 = std::make_shared(model_sig->output(0)); + + // Create a sample model + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // The same pattern perfectly matches 2 different nodes + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); + ASSERT_TRUE(tm.match(pattern_relu, model_sig)); +} +// ! [ov:wrap_type_list] + +void patterns_misc() { +// ! [ov:any_input] + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); +// ! [ov:any_input] + +// ! [ov:wrap_type_predicate] + ov::pass::pattern::wrap_type({pattern::any_input()}, pattern::consumers_count(2)); +// ! [ov:wrap_type_predicate] + + +// ! [ov:any_input_predicate] + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input([](const Output& value){ + return value.get_shape().size() == 4;}), + pattern::any_input([](const Output& value){ + return value.get_shape().size() == 4;})}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); +// ! [ov:any_input_predicate] + + +// ! [ov:optional_predicate] + auto pattern_sig_opt = ov::pass::pattern::optional(pattern_relu, pattern::consumers_count(2)); +// ! [ov:optional_predicate] +} + + +// ! [ov::pattern_or] +TEST(pattern, pattern_or) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a red branch + auto red_pattern_add = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto red_pattern_relu = ov::pass::pattern::wrap_type({red_pattern_add->output(0)}); + auto red_pattern_sigmoid = ov::pass::pattern::wrap_type({red_pattern_relu->output(0)}); + + // Create a blue branch + auto blue_pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto blue_pattern_abs = ov::pass::pattern::wrap_type({blue_pattern_mul->output(0)}); + auto blue_pattern_relu = ov::pass::pattern::wrap_type({blue_pattern_abs->output(0)}); + + // Create Or node + auto pattern_or = std::make_shared(OutputVector{red_pattern_sigmoid->output(0), blue_pattern_relu->output(0)}); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // The same pattern perfectly matches 2 different nodes + ASSERT_TRUE(tm.match(pattern_or, model_relu)); +} +// ! [ov::pattern_or] + + +// ! [ov:pattern_optional_middle] +TEST(pattern, pattern_optional_middle) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a sample pattern with an Optional node in the middle + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_sig_opt = ov::pass::pattern::optional({pattern_abs->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_sig_opt->output(0)}); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // Should perfectly match + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); +} +// ! [ov:pattern_optional_middle] + + +// ! [ov:pattern_optional_top] +TEST(pattern, pattern_optional_top) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a sample pattern an optional top node + auto pattern_sig_opt = ov::pass::pattern::optional(pattern::any_input()); + auto pattern_mul = ov::pass::pattern::wrap_type({pattern_sig_opt, pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // Should perfectly match + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); +} +// ! [ov:pattern_optional_top] + + +// ! [ov:pattern_optional_root] +TEST(pattern, pattern_optional_root) { + // Create a sample model + PartialShape shape{2, 2}; + auto model_param1 = std::make_shared(element::i32, shape); + auto model_param2 = std::make_shared(element::i32, shape); + auto model_add = std::make_shared(model_param1->output(0), model_param2->output(0)); + auto model_param3 = std::make_shared(element::i32, shape); + auto model_mul = std::make_shared(model_add->output(0), model_param3->output(0), false, false); + auto model_abs = std::make_shared(model_mul->output(0)); + auto model_relu = std::make_shared(model_abs->output(0)); + auto model_result = std::make_shared(model_relu->output(0)); + + // Create a sample pattern an optional top node + auto pattern_mul = ov::pass::pattern::wrap_type({pattern::any_input(), pattern::any_input()}); + auto pattern_abs = ov::pass::pattern::wrap_type({pattern_mul->output(0)}); + auto pattern_relu = ov::pass::pattern::wrap_type({pattern_abs->output(0)}); + auto pattern_sig_opt = ov::pass::pattern::optional(pattern_relu); + + // Create a matcher and try to match the nodes + TestMatcher tm; + + // Should perfectly match + ASSERT_TRUE(tm.match(pattern_relu, model_relu)); +} +// ! [ov:pattern_optional_root] \ No newline at end of file diff --git a/docs/articles_en/assets/snippets/ov_patterns.py b/docs/articles_en/assets/snippets/ov_patterns.py new file mode 100644 index 00000000000..f2991148ca7 --- /dev/null +++ b/docs/articles_en/assets/snippets/ov_patterns.py @@ -0,0 +1,217 @@ +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +# ! [ov:imports] +import pytest +from openvino import PartialShape +from openvino.runtime import opset13 as ops +from openvino.runtime.passes import Matcher, WrapType, Or, AnyInput, Optional +# ! [ov:imports] +from openvino.runtime.passes import ( + consumers_count, + has_static_dim, + has_static_dims, + has_static_shape, + has_static_rank, + type_matches, + type_matches_any, +) + +# ! [ov:create_simple_model_and_pattern] +def simple_model_and_pattern(): + # Create a sample model + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a sample pattern + pattern_mul = ops.matmul(AnyInput(), AnyInput(), False, False) + pattern_abs = ops.abs(pattern_mul) + pattern_relu = ops.relu(pattern_abs) + + # Create a matcher and try to match the nodes + matcher = Matcher(pattern_relu, "FindPattern") + + # Should perfectly match + assert matcher.match(model_relu) +# ! [ov:create_simple_model_and_pattern] + +# ! [ov:create_simple_model_and_pattern_wrap_type] +def simple_model_and_pattern_wrap_type(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a sample pattern + pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType("opset13.Relu", pattern_abs) + + # Create a matcher and try to match the nodes + matcher = Matcher(pattern_relu, "FindPattern") + + # Should perfectly match + assert matcher.match(model_relu) +# ! [ov:create_simple_model_and_pattern_wrap_type] + +# ! [ov:wrap_type_list] +def wrap_type_list(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + model_sig = ops.sigmoid(model_abs) # Note that we've added a Sigmoid node after Abs + model_result1 = ops.result(model_sig) + + # Create a sample pattern + pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType(["opset13.Relu", "opset13.Sigmoid"], pattern_abs) + + # Create a matcher and try to match the nodes + matcher = Matcher(pattern_relu, "FindPattern") + + # The same pattern perfectly matches 2 different nodes + assert matcher.match(model_relu) + assert matcher.match(model_sig) +# ! [ov:wrap_type_list] + +def any_input(): +# ! [ov:any_input] + # Create a pattern with a MatMul node taking any inputs. + pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType("opset13.Relu", pattern_abs) +# ! [ov:any_input] + +def wrap_type_predicate(): +# ! [ov:wrap_type_predicate] + WrapType("opset13.Relu", AnyInput(), consumers_count(2)) +# ! [ov:wrap_type_predicate] + +# ! [ov:any_input_predicate] + # Create a pattern with an MatMul node taking any input that has a rank 4. + pattern_mul = WrapType("opset13.MatMul", [AnyInput(lambda output: len(output.get_shape()) == 4), AnyInput(lambda output: len(output.get_shape()) == 4)]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType("opset13.Relu", pattern_abs) +# ! [ov:any_input_predicate] + +# ! [ov::pattern_or] +def pattern_or(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a red branch + red_pattern_add = WrapType("opset13.Add", [AnyInput(), AnyInput()]) + red_pattern_relu = WrapType("opset13.Relu", red_pattern_add) + red_pattern_sigmoid = WrapType(["opset13.Sigmoid"], red_pattern_relu) + + # Create a blue branch + blue_pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + blue_pattern_abs = WrapType("opset13.Abs", blue_pattern_mul) + blue_pattern_relu = WrapType(["opset13.Relu"], blue_pattern_abs) + + #Create Or node + pattern_or = Or([red_pattern_sigmoid, blue_pattern_relu]) + + # Create a matcher and try to match the nodes + matcher = Matcher(pattern_or, "FindPattern") + + # The same pattern perfectly matches 2 different nodes + assert matcher.match(model_relu) +# ! [ov::pattern_or] + +# ! [ov:pattern_optional_middle] +def pattern_optional_middle(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a sample pattern with an Optional node in the middle + pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_sig_opt = Optional(["opset13.Sigmoid"], pattern_abs) + pattern_relu = WrapType("opset13.Relu", pattern_sig_opt) + + # Create a matcher and try to match the nodes + matcher = Matcher(pattern_relu, "FindPattern") + + # Should perfectly match + assert matcher.match(model_relu) +# ! [ov:pattern_optional_middle] + +# ! [ov:pattern_optional_top] +def pattern_optional_top(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a sample pattern an optional top node + pattern_sig_opt = Optional(["opset13.Sigmoid"], AnyInput()) + pattern_mul = WrapType("opset13.MatMul", [pattern_sig_opt, AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType("opset13.Relu", pattern_abs) + + matcher = Matcher(pattern_relu, "FindPattern") + + # Should perfectly match even though there's no Sigmoid going into MatMul + assert matcher.match(model_relu) +# ! [ov:pattern_optional_top] + +# ! [ov:pattern_optional_root] +def pattern_optional_root(): + model_param1 = ops.parameter(PartialShape([2, 2])) + model_param2 = ops.parameter(PartialShape([2, 2])) + model_add = ops.add(model_param1, model_param2) + model_param3 = ops.parameter(PartialShape([2, 2])) + model_mul = ops.matmul(model_add, model_param3, False, False) + model_abs = ops.abs(model_mul) + model_relu = ops.relu(model_abs) + model_result = ops.result(model_relu) + + # Create a sample pattern + pattern_mul = WrapType("opset13.MatMul", [AnyInput(), AnyInput()]) + pattern_abs = WrapType("opset13.Abs", pattern_mul) + pattern_relu = WrapType("opset13.Relu", pattern_abs) + pattern_sig_opt = Optional(["opset13.Sigmoid"], pattern_relu) + + matcher = Matcher(pattern_sig_opt, "FindPattern") + + # Should perfectly match even though there's no Sigmoid as root + assert matcher.match(model_relu) +# ! [ov:pattern_optional_root] + +# ! [ov:optional_predicate] + pattern_sig_opt = Optional(["opset13.Sigmoid"], pattern_relu, consumers_count(1)) +# ! [ov:optional_predicate] diff --git a/docs/articles_en/documentation/openvino-extensibility/transformation-api.rst b/docs/articles_en/documentation/openvino-extensibility/transformation-api.rst index 5e28a22e69a..c179e628f6d 100644 --- a/docs/articles_en/documentation/openvino-extensibility/transformation-api.rst +++ b/docs/articles_en/documentation/openvino-extensibility/transformation-api.rst @@ -16,25 +16,26 @@ Overview of Transformations API transformation-api/model-pass transformation-api/matcher-pass transformation-api/graph-rewrite-pass + transformation-api/patterns-python-api -OpenVINO Transformation mechanism allows to develop transformation passes to modify ``ov::Model``. You can use this mechanism to apply additional optimizations to the original Model or transform unsupported subgraphs and operations to new operations which are supported by the plugin. -This guide contains all necessary information that you need to start implementing OpenVINO™ transformations. +OpenVINO Transformation mechanism allows to develop transformation passes to modify ``ov::Model``. You can use this mechanism to apply additional optimizations to the original Model or transform unsupported subgraphs and operations to new operations supported by the plugin. +This guide contains all the necessary information to start implementing OpenVINO™ transformations. Working with Model ################## -Before the moving to transformation part it is needed to say several words about functions which allow to modify ``ov::Model``. -This chapter extends the :doc:`model representation guide <../../openvino-workflow/running-inference/integrate-openvino-with-your-application/model-representation>` and shows an API that allows us to manipulate with ``ov::Model``. +Before moving to the transformation part, it is important to say a few words about the functions which allow modifying ``ov::Model``. +This section extends the :doc:`model representation guide <../../openvino-workflow/running-inference/integrate-openvino-with-your-application/model-representation>` and introduces an API for ``ov::Model`` manipulation. Working with node input and output ports ++++++++++++++++++++++++++++++++++++++++ -First of all let's talk about ``ov::Node`` input/output ports. Each OpenVINO™ operation has input and output ports except cases when operation has ``Parameter`` or ``Constant`` type. +Each OpenVINO operation has ``ov::Node`` input and output ports, except for ``Parameter`` and ``Constant`` types. +The terms ``node`` and ``operation`` are used interchangeably in OpenVINO, but this article will maintain consistency in their use. -Every port belongs to its node, so using a port we can access parent node, get shape and type for particular input/output, get all consumers in case of output port, and get producer node in case of input port. -With output port we can set inputs for newly created operations. +Every port is associated with a node, allowing access to the node it belongs to, including its shape, type, all consumers for output ports and the producer node for input ports. -Lets look at the code example. +Take a look at the code example: .. doxygensnippet:: docs/articles_en/assets/snippets/ov_model_snippets.cpp :language: cpp @@ -47,7 +48,7 @@ OpenVINO™ provides two ways for node replacement: via OpenVINO™ helper funct Let's start with OpenVINO™ helper functions. The most popular function is ``ov::replace_node(old_node, new_node)``. -We will review real replacement case where Negative operation is replaced with Multiply. +Let's review a replacement case where a Negative operation is replaced with Multiply. .. image:: ../../assets/images/ov_replace_node.png @@ -55,7 +56,7 @@ We will review real replacement case where Negative operation is replaced with M :language: cpp :fragment: [ov:replace_node] -``ov::replace_node`` has a constraint that number of output ports for both of ops must be the same; otherwise, it raises an exception. +``ov::replace_node`` has a constraint that number of output ports for both nodes must be the same. Otherwise, the attempt to replace the nodes will result in an exception. The alternative way to do the same replacement is the following: @@ -63,7 +64,7 @@ The alternative way to do the same replacement is the following: :language: cpp :fragment: [ov:manual_replace] -Another transformation example is insertion. +Another transformation example is insertion. Let's insert an additional Relu node. .. image:: ../../assets/images/ov_insert_node.png @@ -71,7 +72,7 @@ Another transformation example is insertion. :language: cpp :fragment: [ov:insert_node] -The alternative way to the insert operation is to make a node copy and use ``ov::replace_node()``: +The alternative way of inserting a node is to make a copy of the node and use ``ov::replace_node()``: .. doxygensnippet:: docs/articles_en/assets/snippets/ov_model_snippets.cpp :language: cpp @@ -80,15 +81,15 @@ The alternative way to the insert operation is to make a node copy and use ``ov: Node elimination ++++++++++++++++ -Another type of node replacement is its elimination. +Another type of node replacement is elimination of a node. -To eliminate operation, OpenVINO™ has special method that considers all limitations related to OpenVINO™ Runtime. +To eliminate a node, OpenVINO provides a method that considers all limitations of the OpenVINO Runtime. .. doxygensnippet:: docs/articles_en/assets/snippets/ov_model_snippets.cpp :language: cpp :fragment: [ov:eliminate_node] -``ov::replace_output_update_name()`` in case of successful replacement it automatically preserves friendly name and runtime info. +If the replacement is successful, ``ov::replace_output_update_name()`` automatically preserves the friendly name and runtime info. .. _transformations_types: @@ -99,7 +100,7 @@ OpenVINO™ Runtime has three main transformation types: * :doc:`Model pass ` - straightforward way to work with ``ov::Model`` directly * :doc:`Matcher pass ` - pattern-based transformation approach -* :doc:`Graph rewrite pass ` - container for matcher passes needed for efficient execution +* :doc:`Graph rewrite pass ` - container for matcher passes used for efficient execution .. image:: ../../assets/images/transformations_structure.png @@ -116,36 +117,36 @@ Transformation library has two internal macros to support conditional compilatio Transformation writing essentials ################################# -When developing a transformation, you need to follow these transformation rules: +To develop a transformation, follow these transformation rules: 1. Friendly Names +++++++++++++++++ -Each ``ov::Node`` has an unique name and a friendly name. In transformations we care only about friendly name because it represents the name from the model. -To avoid losing friendly name when replacing node with other node or subgraph, set the original friendly name to the latest node in replacing subgraph. See the example below. +Each ``ov::Node`` has a unique name and a friendly name. In transformations, only the friendly name matters because it represents the name from the model's perspective. +To prevent losing the friendly name when replacing a node with another node or a subgraph, the original friendly name is set to the last node in the replacing subgraph. See the example below. .. doxygensnippet:: docs/articles_en/assets/snippets/ov_model_snippets.cpp :language: cpp :fragment: [ov:replace_friendly_name] -In more advanced cases, when replaced operation has several outputs and we add additional consumers to its outputs, we make a decision how to set friendly name by arrangement. +In more complicated cases, when a replaced operation has several outputs and additional consumers are added to its outputs, the decision on how to set the friendly name is determined by an agreement. 2. Runtime Info +++++++++++++++ -Runtime info is a map ``std::map`` located inside ``ov::Node`` class. It represents additional attributes in ``ov::Node``. -These attributes can be set by users or by plugins and when executing transformation that changes ``ov::Model`` we need to preserve these attributes as they will not be automatically propagated. +Runtime info is a map ``std::map`` located inside the ``ov::Node`` class. It represents additional attributes of the ``ov::Node``. +These attributes, which can be set by users or plugins, need to be preserved when executing a transformation that changes ``ov::Model``, as they are not automatically propagated. In most cases, transformations have the following types: 1:1 (replace node with another node), 1:N (replace node with a sub-graph), N:1 (fuse sub-graph into a single node), N:M (any other transformation). -Currently, there is no mechanism that automatically detects transformation types, so we need to propagate this runtime information manually. See the examples below. +Currently, there is no mechanism that automatically detects transformation types, so this runtime information needs to be propagated manually. See the example below: .. doxygensnippet:: docs/articles_en/assets/snippets/ov_model_snippets.cpp :language: cpp :fragment: [ov:copy_runtime_info] -When transformation has multiple fusions or decompositions, ``ov::copy_runtime_info`` must be called multiple times for each case. +When a transformation has multiple fusions or decompositions, ``ov::copy_runtime_info`` must be called multiple times for each case. -.. note:: ``copy_runtime_info`` removes ``rt_info`` from destination nodes. If you want to keep it, you need to specify them in source nodes like this: ``copy_runtime_info({a, b, c}, {a, b})`` +.. note:: ``copy_runtime_info`` removes ``rt_info`` from destination nodes. If you want to keep it, specify them in source nodes as following: ``copy_runtime_info({a, b, c}, {a, b})`` 3. Constant Folding +++++++++++++++++++ @@ -172,21 +173,21 @@ Common mistakes in transformations In transformation development process: -* Do not use deprecated OpenVINO™ API. Deprecated methods has the ``OPENVINO_DEPRECATED`` macros in its definition. -* Do not pass ``shared_ptr`` as an input for other node if type of node is unknown or it has multiple outputs. Use explicit output port. -* If you replace node with another node that produces different shape, remember that new shape will not be propagated until the first ``validate_nodes_and_infer_types`` call for ``ov::Model``. If you are using ``ov::pass::Manager``, it will automatically call this method after each transformation execution. +* Do not use deprecated OpenVINO™ API. Deprecated methods are marked with ``OPENVINO_DEPRECATED`` macro in their definition. +* Do not pass ``shared_ptr`` as input for another node if the type of the node is unknown or if it has multiple outputs. Instead, use explicit output ports. +* If you replace a node with another node that produces different shape, note that the new shape will not be propagated until the first ``validate_nodes_and_infer_types`` call for ``ov::Model``. If you are using ``ov::pass::Manager``, it will automatically call this method after each transformation execution. * Do not forget to call the ``ov::pass::ConstantFolding`` pass if your transformation creates constant subgraphs. * Use latest OpSet if you are not developing downgrade transformation pass. -* When developing a callback for ``ov::pass::MatcherPass``, do not change nodes that come after the root node in topological order. +* When developing a callback for ``ov::pass::MatcherPass``, do not change nodes that come after the root node in the topological order. .. _using_pass_manager: Using pass manager ################## -``ov::pass::Manager`` is a container class that can store the list of transformations and execute them. The main idea of this class is to have high-level representation for grouped list of transformations. -It can register and apply any `transformation pass <#transformations_types>`__ on model. -In addition, ``ov::pass::Manager`` has extended debug capabilities (find more information in the `how to debug transformations <#how_to_debug_transformations>`__ section). +``ov::pass::Manager`` is a container class that can store a list of transformations and execute them. The main idea of this class is to have a high-level representation for grouped list of transformations. +It can register and apply any `transformation pass <#transformations_types>`__ on a model. +In addition, ``ov::pass::Manager`` has extended debug capabilities (find more information in the `how to debug transformations <#how-to-debug-transformations>`__ section). The example below shows basic usage of ``ov::pass::Manager`` diff --git a/docs/articles_en/documentation/openvino-extensibility/transformation-api/patterns-python-api.rst b/docs/articles_en/documentation/openvino-extensibility/transformation-api/patterns-python-api.rst new file mode 100644 index 00000000000..bca893718e8 --- /dev/null +++ b/docs/articles_en/documentation/openvino-extensibility/transformation-api/patterns-python-api.rst @@ -0,0 +1,175 @@ + +Transformation Patterns with OpenVINO API +================================================== + +.. meta:: + :description: Learn how to apply additional model optimizations or transform + unsupported subgraphs and operations using OpenVINO™ Transformations API. + +Pattern matching is an essential component of OpenVINO™ transformations. Before performing any transformation on a subgraph of a graph, it is necessary to find that subgraph in the graph. +Patterns serve as a searching utility to identify nodes intended for transformations. This article covers the basics of pattern +creation using OpenVINO™ API and helpful utilities to facilitate working with them. While this guide focuses on creating patterns, if you want to learn more about ``MatcherPass``, refer to the :doc:`OpenVINO Matcher Pass article <./matcher-pass>`. Note that some examples may be intentionally simplified for ease of understanding. + +Before proceeding further, it is necessary to add some imports. These imports include the operations to be used and additional utilities described in this guide. +Add the following lines to your file: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:imports] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:imports] + +Pattern Creation ++++++++++++++++++++++ + +A pattern is a simplified model comprised of nodes aimed to be matched. It lacks some features of a model and cannot function as one. + +Consider a straightforward pattern consisting of three nodes to be found in a given model. + +.. image:: ./../../../assets/images/simple_pattern_example.png + +Let's create the model and the pattern: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:create_simple_model_and_pattern] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:create_simple_model_and_pattern] + +.. note:: This example uses testing utilities that directly compare given sequences of nodes. In reality, the process of finding a pattern within a model is more complicated. However, to focus only on patterns and their functionality, these details are intentionally omitted. + +Although the code is functional, in OpenVINO, patterns are typically not created using the same nodes as those used for creating the model. Instead, wrappers are preferred, providing additional functionality. +For the given case, ``WrapType`` is used and the code looks as following: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:create_simple_model_and_pattern_wrap_type] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:create_simple_model_and_pattern_wrap_type] + +1. WrapType +++++++++++++++++++++++++++++++++++++++++ + +``WrapType`` is a wrapper used to store one or many types to match them. As demonstrated earlier, it is possible to specify a single type in ``WrapType`` and use it for matching. +However, you can also list all possible types for a given node, for example: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:wrap_type_list] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:wrap_type_list] + +Note that ``pattern_sig`` is created with the list ``["opset13.Relu", "opset13.Sigmoid"]``, meaning it can be either a ``Relu`` or a ``Sigmoid``. +This feature enables matching the same pattern against different nodes. Essentially, ``WrapType`` can represent "one of listed" types. ``WrapType`` supports specifying more than two types. + +To add additional checks for your node, create a predicate by providing a function or a lambda. This function will be executed during matching, performing the additional validation specified in the logic of the function. For example, you might want to check the consumers count of a given node: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:wrap_type_predicate] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:wrap_type_predicate] + +2. AnyInput +++++++++++++++++++++++++++++++++++++++++ +``AnyInput`` is used when there is no need to specify a particular input for a given node. + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:any_input] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:any_input] + +You can also create ``AnyInput()`` with a predicate, if you want additional checks for you input. It will look similar to ``WrapType`` with a lambda or a function. For example, to ensure that the input has a rank of 4: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:any_input_predicate] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:any_input_predicate] + +3. Or +++++++++++++++++++++++++++++++++++++++++ +``Or`` functions similar to ``WrapType``, however, while ``WrapType`` can only match one of the types provided in the list, ``Or`` is used to match different branches of nodes. +Suppose the goal is to match the model against two different sequences of nodes. The ``Or`` type +facilitates this by creating two different branches (``Or`` supports more than two branches), looking as follows: + +.. image:: ./../../../assets/images/or_branches.png + +The red branch will not match, but it will work perfectly for the blue one. +Here is how it looks in code: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:pattern_or] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:pattern_or] + +Note that matching will succeed for the first matching branch and the remaining ones will not be checked. + +4. Optional +++++++++++++++++++++++++++++++++++++++++ +``Optional`` is a bit tricky. It allows specifying whether a node might be present or absent in the model. Under the hood, +the pattern will create two branches using ``Or``: one with the optional node present and another one without it. Here is what it would look like with the ``Optional`` +unfolding into two branches: + +.. image:: ./../../../assets/images/optional.png + +The code for our model looks as follows: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:pattern_optional_middle] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:pattern_optional_middle] + +The ``Optional`` does not necessarily have to be in the middle of the pattern. It can be a top node and a root node. + + +Top node: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:pattern_optional_top] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:pattern_optional_top] + +Root node: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:pattern_optional_root] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:pattern_optional_root] + +``Optional`` also supports adding a predicate the same way ``WrapType`` and ``AnyInput`` do: + +.. doxygensnippet:: docs/snippets/ov_patterns.py + :language: python + :fragment: [ov:optional_predicate] + +.. doxygensnippet:: docs/articles_en/assets/snippets/ov_patterns.cpp + :language: cpp + :fragment: [ov:optional_predicate] \ No newline at end of file diff --git a/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/shape/squeeze-1.rst b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/shape/squeeze-1.rst index 9d426f88e5f..1ccce710ee0 100644 --- a/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/shape/squeeze-1.rst +++ b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/shape/squeeze-1.rst @@ -17,7 +17,10 @@ Squeeze **Detailed description**: *Squeeze* can be used with or without the second input tensor. * If only the first input is provided, every dimension that is equal to 1 will be removed from it. -* With the second input provided, each value is an index of a dimension from the first tensor that is to be removed. Specified dimension has to be equal to 1, otherwise an error will be raised. Dimension indices can be specified directly, or by negative indices (counting dimensions from the end). +* With the second input provided, each value is an index of a dimension from the first tensor that is to be removed. Specified dimension should be equal to 1, otherwise it will be ignored and copied as is. +Dimension indices can be specified directly, or by negative indices (counting dimensions from the end). + +Note: Updated behavior since 2024.3, request of squeezing dimension not equal to 1 is expected to be ignored instead of causing an error. **Attributes**: *Squeeze* operation doesn't have attributes. @@ -87,4 +90,3 @@ Squeeze - diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-apt.rst b/docs/articles_en/get-started/install-openvino/install-openvino-apt.rst index 7096284df6c..058b93f3b9d 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-apt.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-apt.rst @@ -155,7 +155,7 @@ Step 2: Install OpenVINO Runtime Using the APT Package Manager .. code-block:: sh - sudo apt install openvino-2024.0.0 + sudo apt install openvino-2024.2.0 .. note:: @@ -228,7 +228,7 @@ To uninstall OpenVINO Runtime via APT, run the following command based on your n .. code-block:: sh - sudo apt autoremove openvino-2024.0.0 + sudo apt autoremove openvino-2024.2.0 What's Next? diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-conan.rst b/docs/articles_en/get-started/install-openvino/install-openvino-conan.rst index b66e5f993bf..38e5871af20 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-conan.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-conan.rst @@ -52,7 +52,7 @@ Installing OpenVINO Runtime with Conan Package Manager .. code-block:: sh [requires] - openvino/2024.1.0 + openvino/2024.2.0 [generators] CMakeDeps CMakeToolchain diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-conda.rst b/docs/articles_en/get-started/install-openvino/install-openvino-conda.rst index 123a5258662..d5461348e35 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-conda.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-conda.rst @@ -64,7 +64,7 @@ Installing OpenVINO Runtime with Anaconda Package Manager .. code-block:: sh - conda install -c conda-forge openvino=2024.1.0 + conda install -c conda-forge openvino=2024.2.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 @@ -115,7 +115,7 @@ with the proper OpenVINO version number: .. code-block:: sh - conda remove openvino=2024.1.0 + conda remove openvino=2024.2.0 What's Next? ############################################################ diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-yum.rst b/docs/articles_en/get-started/install-openvino/install-openvino-yum.rst index 2d404187b16..a5559e937e5 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-yum.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-yum.rst @@ -128,7 +128,7 @@ Install OpenVINO Runtime .. code-block:: sh - sudo yum install openvino-2024.0.0 + sudo yum install openvino-2024.2.0 @@ -199,7 +199,7 @@ To uninstall OpenVINO Runtime via YUM, run the following command based on your n .. code-block:: sh - sudo yum autoremove openvino-2024.0.0 + sudo yum autoremove openvino-2024.2.0 diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-zypper.rst b/docs/articles_en/get-started/install-openvino/install-openvino-zypper.rst index ca61d358442..20166da049f 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-zypper.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-zypper.rst @@ -143,7 +143,7 @@ To uninstall OpenVINO Runtime via ZYPPER, run the following command based on you .. code-block:: sh - sudo zypper remove *openvino-2024.0.0* + sudo zypper remove *openvino-2024.2.0* diff --git a/docs/articles_en/learn-openvino/interactive-tutorials-python/notebooks-installation.rst b/docs/articles_en/learn-openvino/interactive-tutorials-python/notebooks-installation.rst index bda27362fbf..8a5fe913959 100644 --- a/docs/articles_en/learn-openvino/interactive-tutorials-python/notebooks-installation.rst +++ b/docs/articles_en/learn-openvino/interactive-tutorials-python/notebooks-installation.rst @@ -32,15 +32,17 @@ The table below lists the supported operating systems and Python versions. | | (64-bit | | | ) `__ | +=====================================+================================+ -| Ubuntu 18.04 LTS | 3.8, 3.9, 3.10. 3.11 | +| Ubuntu 20.04 LTS, 64-bit | 3.8, 3.9, 3.10. 3.11 | +-------------------------------------+--------------------------------+ -| Ubuntu 20.04 LTS | 3.8, 3.9, 3.10, 3.11 | +| Ubuntu 22.04 LTS, 64-bit | 3.8, 3.9, 3.10, 3.11 | +-------------------------------------+--------------------------------+ | Red Hat Enterprise Linux 8 | 3.8, 3.9, 3.10, 3.11 | +-------------------------------------+--------------------------------+ -| macOS 12.6.x versions | 3.8, 3.9, 3.10, 3.11 | +| CentOS 7, 64 bit | 3.8, 3.9, 3.10, 3.11 | +-------------------------------------+--------------------------------+ -| Windows 10 Pro, Enterprise | 3.8, 3.9, 3.10, 3.11 | +| macOS 10.15.x versions or higher | 3.8, 3.9, 3.10, 3.11 | ++-------------------------------------+--------------------------------+ +| Windows 10, 64-bit Pro, Enterprise | 3.8, 3.9, 3.10, 3.11 | | or Education editions | | +-------------------------------------+--------------------------------+ | Windows Server 2016 or higher | 3.8, 3.9, 3.10, 3.11 | @@ -64,6 +66,7 @@ Installing prerequisites Run the installer by double clicking it. Follow the installation steps to set up the software. While installing, make sure you check the box to *add Python to system PATH*. + Also, it is recommended to use the installer option to disable the PATH length limit. .. note:: @@ -81,6 +84,12 @@ Installing prerequisites Run the installer by double clicking it. Follow the installation steps to set up the software. + 4. (Optional) Install FFMPEG + + Download FFMPEG binary from `here `__ + + Set FFMPEG's path (e.g., ``C:\ffmpeg\bin``) to the PATH environmental variable on Windows. + .. tab-item:: Linux :sync: linux @@ -96,7 +105,7 @@ Installing prerequisites sudo apt-get update sudo apt-get upgrade - sudo apt-get install python3-venv build-essential python3-dev git-all + sudo apt-get install python3-venv build-essential python3-dev git-all libgl1-mesa-dev ffmpeg For an Intel Integrated Graphics Card, you can install the `Intel Graphics Compute Runtime `__ to enable inference on this device. The command for Ubuntu 20.04 is: @@ -133,7 +142,8 @@ Installing prerequisites .. code-block:: sh /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - After you install it, follow the instructions from the Homebrew installation to set it up. + + After you install it, follow the instructions from the Homebrew installation to set it up. 3. **Install Python and dependencies** @@ -142,6 +152,8 @@ Installing prerequisites brew install python@3.9 brew install protobuf + # optional but recommended + brew install ffmpeg Run each step below in a terminal. @@ -250,6 +262,56 @@ Installing prerequisites CMD /tmp/scripts/run + .. tab-item:: Amazon SageMaker + :sync: amazon-sagemaker + + .. note:: + + An `AWS `__ + account and access to + `Amazon SageMaker Studio `__ + are required. + + 1. **Log into your Amazon SageMaker Studio Environment and** ``Add user``. + + |amazon-studio-1| + + 2. **Choose desired user profile name** + + |amazon-studio-2| + + 3. **Choose Jupyter Lab version 3.0** + + |amazon-studio-3| + + 4. **Choose the remaining default setting and click "Submit" to add a user.** + 5. **Launch the Amazon SageMaker Studio environment.** + + Click "Open Studio" to start the environment: + + |amazon-studio-4| + + .. note:: + + You are using an ``ml.t3.medium`` instance, which is for free for + 250 hours per month for the first 2 months on Studio notebook. + + 6. **Wait for a couple of minutes for your environment to load.** + + You should be able to see the following screen: + + |amazon-studio-5| + + 7. **Select a SageMaker image.** + + Choose ``Data Science 3.0`` in "Select a SageMaker image" drop-down under + "Notebooks and compute resources". + + Then, click **+** on "Image Terminal" to start a terminal session: + + |amazon-studio-6| + + Installing notebooks ++++++++++++++++++++ @@ -294,6 +356,19 @@ Installing notebooks pip install -r requirements.txt + + .. important:: + + In case of problems with accessing HuggingFace in PRC, set-up the networking + environment before you launch the notebooks: + + .. code-block:: + + pip install -U huggingface_hub + set HF_ENDPOINT = https://hf-mirror.com + + For more information, visit `HF-Mirror HuggingFace `__. + .. tab-item:: Linux :sync: linux @@ -333,6 +408,18 @@ Installing notebooks pip install -r requirements.txt + .. important:: + + In case of problems with accessing HuggingFace in PRC, set-up the networking + environment before you launch the notebooks: + + .. code-block:: + + pip install -U huggingface_hub + set HF_ENDPOINT = https://hf-mirror.com + + For more information, visit `HF-Mirror HuggingFace `__. + .. tab-item:: macOS :sync: macos @@ -475,6 +562,69 @@ Installing notebooks While running the container on Windows and macOS, only CPU devices can be used. To access the iGPU, install the notebooks locally, following the instructions above. + .. tab-item:: Amazon SageMaker + :sync: amazon-sagemaker + + + **Use the terminal and follow the steps below.** + + |amazon-studio-7| + + + 1. **Install few system dependencies.** + + .. code-block:: + + apt update + apt install build-essential -y + apt install libpython3.9-dev -y + apt install libgl1-mesa-glx -y + + 2. **Setup OpenVINO conda environment.** + + .. code-block:: + + conda create --name openvino_env python=3.9 + conda activate openvino_env + conda install ipykernel + set PATH="/anaconda/envs/openvino_env/bin;%PATH%" + + 3. **Setup OpenVINO Notebooks.** + + .. code-block:: + + git clone https://github.com/openvinotoolkit/openvino_notebooks.git + cd openvino_notebooks + # Install OpenVINO and OpenVINO notebook Requirements + python -m pip install --upgrade pip + pip install -r requirements.txt + + 4. **Run the Notebooks** + + * To run the notebooks, click the top level "openvino_notebooks" folder + and navigate to your example: + + |amazon-studio-8| + + * Choose "Image" - ``Data Science 3.0``, + "Kernel" - ``Python [conda env:openvino_env],`` + "Instance type"- your desired compute instance. + + |amazon-studio-9| + + |amazon-studio-10| + + |amazon-studio-11| + + .. note:: + + Make sure you use the ``Python [conda env:openvino_env]`` + environment (not ``Python 3``). + + * Next, run the cells of the notebook. You may try other notebooks to + explore OpenVINO features and examples. + + Run the Notebooks ################# @@ -614,6 +764,27 @@ Additional Resources .. |ml-studio-2| image:: https://user-images.githubusercontent.com/15709723/117582205-b6f4d580-b0b5-11eb-9b83-eb2004ad9b19.png +.. |amazon-studio-1| image:: https://user-images.githubusercontent.com/4837253/199801883-7bb64ad2-bb7f-4477-ace1-25111d4fd43c.png + +.. |amazon-studio-2| image:: https://user-images.githubusercontent.com/4837253/199802173-8d65c851-604b-4b92-bafa-cae86b17d1ec.png + +.. |amazon-studio-3| image:: https://user-images.githubusercontent.com/4837253/199802353-14c17233-3dae-4649-bbfe-59b8a598450c.png + +.. |amazon-studio-4| image:: https://user-images.githubusercontent.com/4837253/199802726-97c85732-ff25-4cdd-ad6e-d491b4ed122b.png + +.. |amazon-studio-5| image:: https://user-images.githubusercontent.com/15709723/199784252-c8581c73-342a-4c70-9207-5543d7b87346.png + +.. |amazon-studio-6| image:: https://user-images.githubusercontent.com/4837253/199805717-5d102d27-e92e-4426-8d14-0484fd5ba24c.png + +.. |amazon-studio-7| image:: https://user-images.githubusercontent.com/4837253/199807022-3cc5dd9e-f9f0-445d-be5e-d429dc1b752c.png + +.. |amazon-studio-8| image:: https://user-images.githubusercontent.com/4837253/199810405-0f6748e1-d5f5-469e-8305-a96724dfffba.png + +.. |amazon-studio-9| image:: https://user-images.githubusercontent.com/4837253/199812540-c52ea429-9d53-4bdb-aec1-a0b8616c6fcc.png + +.. |amazon-studio-10| image:: https://user-images.githubusercontent.com/4837253/199812587-20c3e360-3a31-4032-b17a-8b242d6ccc26.png + +.. |amazon-studio-11| image:: https://user-images.githubusercontent.com/4837253/199812713-32074aa7-8190-43c8-815c-231542c7b286.png + .. |docker-terminal-1| image:: https://user-images.githubusercontent.com/15709723/127793994-355e4d29-d131-432d-a12a-b08ca6131223.png - diff --git a/docs/articles_en/learn-openvino/openvino-samples/bert-benchmark.rst b/docs/articles_en/learn-openvino/openvino-samples/bert-benchmark.rst index 43c703a47be..eb710813f0e 100644 --- a/docs/articles_en/learn-openvino/openvino-samples/bert-benchmark.rst +++ b/docs/articles_en/learn-openvino/openvino-samples/bert-benchmark.rst @@ -9,7 +9,7 @@ Bert Benchmark Python Sample This sample demonstrates how to estimate performance of a Bert model using Asynchronous -Inference Request API. Unlike `demos `__ this sample does not have +Inference Request API. Unlike `demos `__ this sample does not have configurable command line arguments. Feel free to modify sample's source code to try out different options. diff --git a/docs/articles_en/learn-openvino/openvino-samples/get-started-demos.rst b/docs/articles_en/learn-openvino/openvino-samples/get-started-demos.rst index a0137b0ee25..c5c48a5319a 100644 --- a/docs/articles_en/learn-openvino/openvino-samples/get-started-demos.rst +++ b/docs/articles_en/learn-openvino/openvino-samples/get-started-demos.rst @@ -264,7 +264,7 @@ You need a model that is specific for your inference task. You can get it from o Convert the Model -------------------- -If Your model requires conversion, check the `article `__ for information how to do it. +If Your model requires conversion, check the `article `__ for information how to do it. .. _download-media: diff --git a/docs/articles_en/learn-openvino/openvino-samples/hello-nv12-input-classification.rst b/docs/articles_en/learn-openvino/openvino-samples/hello-nv12-input-classification.rst index 888e4fd142c..9c48454afc0 100644 --- a/docs/articles_en/learn-openvino/openvino-samples/hello-nv12-input-classification.rst +++ b/docs/articles_en/learn-openvino/openvino-samples/hello-nv12-input-classification.rst @@ -211,6 +211,6 @@ Additional Resources - :doc:`Get Started with Samples ` - :doc:`Using OpenVINO Samples <../openvino-samples>` - :doc:`Convert a Model <../../documentation/legacy-features/transition-legacy-conversion-api/legacy-conversion-api>` -- `API Reference `__ +- `API Reference `__ - `Hello NV12 Input Classification C++ Sample on Github `__ - `Hello NV12 Input Classification C Sample on Github `__ diff --git a/docs/articles_en/learn-openvino/openvino-samples/sync-benchmark.rst b/docs/articles_en/learn-openvino/openvino-samples/sync-benchmark.rst index d706c2fb22f..d001e5c018e 100644 --- a/docs/articles_en/learn-openvino/openvino-samples/sync-benchmark.rst +++ b/docs/articles_en/learn-openvino/openvino-samples/sync-benchmark.rst @@ -11,7 +11,7 @@ Sync Benchmark Sample This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike -`demos `__ this sample does not have other configurable command-line +`demos `__ this sample does not have other configurable command-line arguments. Feel free to modify sample's source code to try out different options. Before using the sample, refer to the following requirements: diff --git a/docs/articles_en/learn-openvino/openvino-samples/throughput-benchmark.rst b/docs/articles_en/learn-openvino/openvino-samples/throughput-benchmark.rst index 9e11cdfc6e9..6fbdaf8dd99 100644 --- a/docs/articles_en/learn-openvino/openvino-samples/throughput-benchmark.rst +++ b/docs/articles_en/learn-openvino/openvino-samples/throughput-benchmark.rst @@ -9,7 +9,7 @@ Throughput Benchmark Sample This sample demonstrates how to estimate performance of a model using Asynchronous -Inference Request API in throughput mode. Unlike `demos `__ this sample +Inference Request API in throughput mode. Unlike `demos `__ this sample does not have other configurable command-line arguments. Feel free to modify sample's source code to try out different options. diff --git a/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst b/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst index a395e5ed942..7289c6cbe02 100644 --- a/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst +++ b/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst @@ -1,5 +1,3 @@ -.. {#openvino_docs_OV_Converter_UG_prepare_model_convert_model_Convert_Model_From_PyTorch} - Converting a PyTorch Model ========================== @@ -30,11 +28,19 @@ Here is the simplest example of PyTorch model conversion using a model from ``to * ``torch.jit.ScriptFunction`` * ``torch.export.ExportedProgram`` -When using ``torch.nn.Module`` as an input model, ``openvino.convert_model`` often requires the ``example_input`` parameter to be specified. Internally, it triggers the model tracing during the model conversion process, using the capabilities of the ``torch.jit.trace`` function. +When using ``torch.nn.Module`` as an input model, ``openvino.convert_model`` often requires the +``example_input`` parameter to be specified. Internally, it triggers the model tracing during +the model conversion process, using the capabilities of the ``torch.jit.trace`` function. -The use of ``example_input`` can lead to a better quality OpenVINO model in terms of correctness and performance compared to converting the same original model without specifying ``example_input``. While the necessity of ``example_input`` depends on the implementation details of a specific PyTorch model, it is recommended to always set the ``example_input`` parameter when it is available. +The use of ``example_input`` can lead to a better quality OpenVINO model in terms of correctness +and performance compared to converting the same original model without specifying +``example_input``. While the necessity of ``example_input`` depends on the implementation +details of a specific PyTorch model, it is recommended to always set the ``example_input`` +parameter when it is available. -The value for the ``example_input`` parameter can be easily derived from knowing the input tensor's element type and shape. While it may not be suitable for all cases, random numbers can frequently serve this purpose effectively: +The value for the ``example_input`` parameter can be easily derived from knowing the input +tensor's element type and shape. While it may not be suitable for all cases, random numbers can +frequently serve this purpose effectively: .. code-block:: py :force: @@ -46,7 +52,11 @@ The value for the ``example_input`` parameter can be easily derived from knowing model = torchvision.models.resnet50(weights='DEFAULT') ov_model = ov.convert_model(model, example_input=torch.rand(1, 3, 224, 224)) -In practice, the code to evaluate or test the PyTorch model is usually provided with the model itself and can be used to generate a proper ``example_input`` value. A modified example of using ``resnet50`` model from ``torchvision`` is presented below. It demonstrates how to switch inference in the existing PyTorch application to OpenVINO and how to get value for ``example_input``: +In practice, the code to evaluate or test the PyTorch model is usually provided with the model +itself and can be used to generate a proper ``example_input`` value. A modified example of using +``resnet50`` model from ``torchvision`` is presented below. It demonstrates how to switch +inference in the existing PyTorch application to OpenVINO and how to get value for +``example_input``: .. code-block:: py :force: @@ -89,7 +99,9 @@ Check out more examples in :doc:`interactive Python tutorials <../../learn-openv .. note:: - In the examples above the ``openvino.save_model`` function is not used because there are no PyTorch-specific details regarding the usage of this function. In all examples, the converted OpenVINO model can be saved to IR by calling ``ov.save_model(ov_model, 'model.xml')`` as usual. + In the examples above the ``openvino.save_model`` function is not used because there are no + PyTorch-specific details regarding the usage of this function. In all examples, the converted + OpenVINO model can be saved to IR by calling ``ov.save_model(ov_model, 'model.xml')`` as usual. Supported Input Parameter Types ############################### @@ -100,44 +112,75 @@ If the model has a single input, the following input types are supported in ``ex * ``torch.Tensor`` * ``tuple`` or any nested combination of tuples -If a model has multiple inputs, the input values are combined in a ``list``, a ``tuple``, or a ``dict``: +If a model has multiple inputs, the input values are combined in a ``list``, a ``tuple``, or a +``dict``: -* values in a ``list`` or ``tuple`` should be passed in the same order as the original model specifies, +* values in a ``list`` or ``tuple`` should be passed in the same order as the original model + specifies, * ``dict`` has keys from the names of the original model argument names. -Enclosing in ``list``, ``tuple`` or ``dict`` can be used for a single input as well as for multiple inputs. +Enclosing in ``list``, ``tuple`` or ``dict`` can be used for a single input as well as for +multiple inputs. -If a model has a single input parameter and the type of this input is a ``tuple``, it should be always passed enclosed into an extra ``list``, ``tuple`` or ``dict`` as in the case of multiple inputs. It is required to eliminate ambiguity between ``model((a, b))`` and ``model(a, b)`` in this case. +If a model has a single input parameter and the type of this input is a ``tuple``, it should be +always passed enclosed into an extra ``list``, ``tuple`` or ``dict`` as in the case of multiple +inputs. It is required to eliminate ambiguity between ``model((a, b))`` and ``model(a, b)`` in +this case. Non-tensor Data Types ##################### -When a non-tensor data type, such as a ``tuple`` or ``dict``, appears in a model input or output, it is flattened. The flattening means that each element within the ``tuple`` will be represented as a separate input or output. The same is true for ``dict`` values, where the keys of the ``dict`` are used to form a model input/output name. The original non-tensor input or output is replaced by one or multiple new inputs or outputs resulting from this flattening process. This flattening procedure is applied recursively in the case of nested ``tuples``, ``lists``, and ``dicts`` until it reaches the assumption that the most nested data type is a tensor. +When a non-tensor data type, such as a ``tuple`` or ``dict``, appears in a model input or output, +it is flattened. The flattening means that each element within the ``tuple`` will be represented +as a separate input or output. The same is true for ``dict`` values, where the keys of the +``dict`` are used to form a model input/output name. The original non-tensor input or output is +replaced by one or multiple new inputs or outputs resulting from this flattening process. This +flattening procedure is applied recursively in the case of nested ``tuples``, ``lists``, and +``dicts`` until it reaches the assumption that the most nested data type is a tensor. -For example, if the original model is called with ``example_input=(a, (b, c, (d, e)))``, where ``a``, ``b``, ... ``e`` are tensors, it means that the original model has two inputs. The first is a tensor ``a``, and the second is a tuple ``(b, c, (d, e))``, containing two tensors ``b`` and ``c`` and a nested tuple ``(d, e)``. Then the resulting OpenVINO model will have signature ``(a, b, c, d, e)``, which means it will have five inputs, all of type tensor, instead of two in the original model. +For example, if the original model is called with ``example_input=(a, (b, c, (d, e)))``, where +``a``, ``b``, ... ``e`` are tensors, it means that the original model has two inputs. The first +is a tensor ``a``, and the second is a tuple ``(b, c, (d, e))``, containing two tensors ``b`` +and ``c`` and a nested tuple ``(d, e)``. Then the resulting OpenVINO model will have signature +``(a, b, c, d, e)``, which means it will have five inputs, all of type tensor, instead of two in +the original model. -If your model has a ``dict`` input, such as, ``{"x": a, "y": b, "z": c}``, it will be decomposed into multiple inputs of the OpenVINO model signature: ``(a, b, c)``, where inputs assume the names of ``x``, ``y``, and ``z`` respectively. +If your model has a ``dict`` input, such as, ``{"x": a, "y": b, "z": c}``, it will be decomposed +into multiple inputs of the OpenVINO model signature: ``(a, b, c)``, where inputs assume the +names of ``x``, ``y``, and ``z`` respectively. .. note:: - An important consequence of flattening is that only ``tuple`` and ``dict`` with a fixed number of elements and key values are supported. The structure of such inputs should be fully described in the ``example_input`` parameter of ``convert_model``. The flattening on outputs should be reproduced with the given ``example_input`` and cannot be changed once the conversion is done. + An important consequence of flattening is that only ``tuple`` and ``dict`` with a fixed number + of elements and key values are supported. The structure of such inputs should be fully + described in the ``example_input`` parameter of ``convert_model``. The flattening on outputs + should be reproduced with the given ``example_input`` and cannot be changed once the + conversion is done. Check out more examples of model conversion with non-tensor data types in the following tutorials: -* `Video Subtitle Generation using Whisper and OpenVINO™ `__ -* `Visual Question Answering and Image Captioning using BLIP and OpenVINO `__ +* `Video Subtitle Generation using Whisper and OpenVINO™ + `__ +* `Visual Question Answering and Image Captioning using BLIP and OpenVINO + `__ Input and output names of the model ################################### -PyTorch doesn't produce relevant names for model inputs and outputs in the TorchScript representation. OpenVINO will assign input names based on the signature of models's ``forward`` method or ``dict`` keys provided in the ``example_input``. Output names will be assigned if there is a ``dict`` at the output or when there is some internal name available in the TorchScript model representation. In general, the output name is not assigned and stays empty. It is recommended to address model outputs by the index rather then the name. +PyTorch doesn't produce relevant names for model inputs and outputs in the TorchScript +representation. OpenVINO will assign input names based on the signature of models's ``forward`` +method or ``dict`` keys provided in the ``example_input``. Output names will be assigned if +there is a ``dict`` at the output or when there is some internal name available in the +TorchScript model representation. In general, the output name is not assigned and stays empty. +It is recommended to address model outputs by the index rather then the name. Support for torch.export ######################## -`torch.export ` is the current way to get a graph representation of a model (since PyTorch 2.1). It produces ``ExportedProgram`` which includes the graph representation in the FX format. Refer to -`PyTorch documentation `__ -to see why it has advantage over the TorchScript representation. +`torch.export `__ is the current way to get a graph +representation of a model (since PyTorch 2.1). It produces ``ExportedProgram`` which includes +the graph representation in the FX format. To see why it has an advantage over the TorchScript +representation, refer to `PyTorch documentation `__. Here is an example of how to convert a model obtained with ``torch.export``: @@ -155,14 +198,20 @@ Here is an example of how to convert a model obtained with ``torch.export``: .. note:: - This is an experimental feature. Use it only if you know that you need to. PyTorch version 2.2 is recommended. Dynamic shapes are not supported yet. + This is an experimental feature. Use it only if you know that you need to. PyTorch version 2.2 + is recommended. Dynamic shapes are not supported yet. Exporting a PyTorch Model to ONNX Format ######################################## -An alternative method of converting PyTorch models is exporting a PyTorch model to ONNX with ``torch.onnx.export`` first and then converting the resulting ``.onnx`` file to OpenVINO Model with ``openvino.convert_model``. It can be considered as a backup solution if a model cannot be converted directly from PyTorch to OpenVINO as described in the above chapters. Converting through ONNX can be more expensive in terms of code, conversion time, and allocated memory. +An alternative method of converting PyTorch models is exporting a PyTorch model to ONNX with +``torch.onnx.export`` first and then converting the resulting ``.onnx`` file to OpenVINO Model +with ``openvino.convert_model``. It can be considered as a backup solution if a model cannot be +converted directly from PyTorch to OpenVINO as described in the above chapters. Converting through +ONNX can be more expensive in terms of code, conversion time, and allocated memory. -1. Refer to the `Exporting PyTorch models to ONNX format `__ guide to learn how to export models from PyTorch to ONNX. +1. Refer to the `Exporting PyTorch models to ONNX format `__ + guide to learn how to export models from PyTorch to ONNX. 2. Follow :doc:`Convert an ONNX model ` chapter to produce OpenVINO model. Here is an illustration of using these two steps together: @@ -182,6 +231,9 @@ Here is an illustration of using these two steps together: .. note:: - As of version 1.8.1, not all PyTorch operations can be exported to ONNX opset 9 which is used by default. - It is recommended to export models to opset 11 or higher when export to default opset 9 is not working. In that case, use ``opset_version`` option of the ``torch.onnx.export``. For more information about ONNX opset, refer to the `Operator Schemas `__ page. + As of version 1.8.1, not all PyTorch operations can be exported to ONNX opset 9 which is + used by default. It is recommended to export models to opset 11 or higher when export to + default opset 9 is not working. In that case, use ``opset_version`` option of the + ``torch.onnx.export``. For more information about ONNX opset, refer to the + `Operator Schemas `__ page. diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.rst index 6f817349800..e2f87fed9d3 100644 --- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.rst +++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.rst @@ -3,7 +3,11 @@ CPU Device ========== +.. toctree:: + :maxdepth: 1 + :hidden: + cpu-device/performance-hint-and-thread-scheduling .. meta:: :description: The CPU plugin in the Intel® Distribution of OpenVINO™ toolkit @@ -230,6 +234,8 @@ This can be achieved by specifying ``MULTI:CPU,GPU.0`` as a target device in cas For more details, see the :doc:`Multi-device execution ` article. +.. _multi_stream_execution: + Multi-stream Execution +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -238,7 +244,7 @@ property is set for CPU plugin, then multiple streams are created for the model. host thread, which means that incoming infer requests can be processed simultaneously. Each stream is pinned to its own group of physical cores with respect to NUMA nodes physical memory usage to minimize overhead on data transfer between NUMA nodes. -For more details, see the :doc:`optimization guide <../optimize-inference>`. +For more details, see the :doc:`optimization guide <../optimize-inference>` and :doc:`thread scheduling introduction `. .. note:: @@ -246,7 +252,6 @@ For more details, see the :doc:`optimization guide <../optimize-inference>`. on data transfer between NUMA nodes. In that case it is better to use the ``ov::hint::PerformanceMode::LATENCY`` performance hint. For more details see the :doc:`performance hints <../optimize-inference/high-level-performance-hints>` overview. - Dynamic Shapes +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -387,70 +392,8 @@ Multi-Threading Optimization CPU inference will infer an input or multiple inputs in parallel on multiple logical processors. -User can use the following properties to limit available CPU resource for model inference. If the platform or operating system can support this behavior, OpenVINO Runtime will perform multi-threading scheduling based on limited available CPU. +For more details, see the :doc:`thread scheduling introduction `. -- ``ov::inference_num_threads`` limits number of logical processors used for CPU inference. - If the number set by the user is greater than the number of logical processors on the platform, multi-threading scheduler only uses the platform number for CPU inference. -- ``ov::hint::scheduling_core_type`` limits the type of CPU cores for CPU inference when user runs inference on a hybird platform that includes both Performance-cores (P-cores) with Efficient-cores (E-cores). - If user platform only has one type of CPU cores, this property has no effect, and CPU inference always uses this unique core type. -- ``ov::hint::enable_hyper_threading`` limits the use of one or two logical processors per CPU core when platform has CPU hyperthreading enabled. - If there is only one logical processor per CPU core, such as Efficient-cores, this property has no effect, and CPU inference uses all logical processors. - -.. tab-set:: - - .. tab-item:: Python - :sync: py - - .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.py - :language: python - :fragment: [ov:intel_cpu:multi_threading:part0] - - .. tab-item:: C++ - :sync: cpp - - .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.cpp - :language: cpp - :fragment: [ov:intel_cpu:multi_threading:part0] - - -.. note:: - - ``ov::hint::scheduling_core_type`` and ``ov::hint::enable_hyper_threading`` only support Intel® x86-64 CPU on Linux and Windows in current release. - -In some use cases, OpenVINO Runtime will enable CPU threads pinning by default for better performance. User can also turn it on or off using property ``ov::hint::enable_cpu_pinning``. Disable threads pinning might be beneficial in complex applications with several workloads executed in parallel. The following table describes the default setting for ``ov::hint::enable_cpu_pinning`` in different use cases. - -==================================================== ================================ - Use Case Default Setting of CPU Pinning -==================================================== ================================ - All use cases with Windows OS False - Stream contains both Pcore and Ecore with Linux OS False - Stream only contains Pcore or Ecore with Linux OS True - All use cases with Mac OS False -==================================================== ================================ - -.. tab-set:: - - .. tab-item:: Python - :sync: py - - .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.py - :language: python - :fragment: [ov:intel_cpu:multi_threading:part1] - - .. tab-item:: C++ - :sync: cpp - - .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.cpp - :language: cpp - :fragment: [ov:intel_cpu:multi_threading:part1] - - -For details on multi-stream execution check the -:doc:`optimization guide <../optimize-inference/optimizing-throughput/advanced_throughput_options>`. - -.. note:: - - ``ov::hint::enable_cpu_pinning`` is not supported on multi-socket platforms with Windows OS. Denormals Optimization +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device/performance-hint-and-thread-scheduling.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device/performance-hint-and-thread-scheduling.rst new file mode 100644 index 00000000000..5abd4dbcec6 --- /dev/null +++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device/performance-hint-and-thread-scheduling.rst @@ -0,0 +1,188 @@ +Performance Hints and Thread Scheduling +======================================== + +.. meta:: + :description: Thread Scheduling of the CPU plugin in OpenVINO™ Runtime + detects CPU architecture and sets low-level properties based + on performance hints automatically. + +To simplify the configuration of hardware devices, it is recommended to use the +:doc:` ov::hint::PerformanceMode::LATENCY and ov::hint::PerformanceMode::THROUGHPUT <../../../../optimize-inference/high-level-performance-hints>` +high-level performance hints. Both performance hints ensure optimal portability +and scalability of applications across various platforms and models. + +- ``ov::inference_num_threads`` limits the number of logical processors used for CPU inference. + If the number set by the user is greater than the number of logical processors on the platform, + the multi-threading scheduler only uses the platform number for CPU inference. +- ``ov::num_streams`` limits the number of infer requests that can be run in parallel. + If the number set by the user is greater than the number of inference threads, multi-threading + scheduler only uses the number of inference threads to ensure that there is at least + one thread per stream. +- ``ov::hint::scheduling_core_type`` specifies the type of CPU cores for CPU inference when + the user runs inference on a hybird platform that includes both Performance-cores (P-cores) + and Efficient-cores (E-cores). If the user platform only has one type of CPU core, this + property has no effect, and CPU inference always uses this unique core type. +- ``ov::hint::enable_hyper_threading`` limits the use of one or two logical processors per CPU + core when the platform has CPU hyperthreading enabled. + If there is only one logical processor per CPU core, such as Efficient-cores, this + property has no effect, and CPU inference uses all logical processors. +- ``ov::hint::enable_cpu_pinning`` enables CPU pinning during CPU inference. + If the user enables this property but the inference scenario does not support it, this + property will be disabled during model compilation. + +For additional details on the above configurations, refer to +:ref:`Multi-stream Execution `. + +Latency Hint +##################### + +In this scenario, the default setting of ``ov::hint::scheduling_core_type`` is determined by +the model precision and the ratio of P-cores and E-cores. + +.. note:: + + P-cores is short for Performance-cores and E-cores stands for Efficient-cores. These + types of cores are available starting with the 12th Gen Intel® Core™ processors. + +.. _Core Type Table of Latency Hint: ++----------------------------+---------------------+---------------------+ +| | INT8 Model | FP32 Model | ++============================+=====================+=====================+ +| E-cores / P-cores < 2 | P-cores | P-cores | ++----------------------------+---------------------+---------------------+ +| 2 <= E-cores / P-cores < 4 | P-cores | P-cores and E-cores | ++----------------------------+---------------------+---------------------+ +| 4 <= E-cores / P-cores | P-cores and E-cores | P-cores and E-cores | ++----------------------------+---------------------+---------------------+ + +.. note:: + + Both P-cores and E-cores may be used for any configuration starting with 14th Gen Intel® + Core™ processors on Windows. + +Then the default settings for low-level performance properties on Windows and Linux are as follows: + ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ +| Property | Windows | Linux | ++======================================+========================================================================+====================================================================+ +| ``ov::num_streams`` | 1 | 1 | ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ +| ``ov::inference_num_threads`` | is equal to the number of P-cores or P-cores+E-cores on one socket | is equal to the number of P-cores or P-cores+E-cores on one socket | ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ +| ``ov::hint::scheduling_core_type`` | `Core Type Table of Latency Hint`_ | `Core Type Table of Latency Hint`_ | ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ +| ``ov::hint::enable_hyper_threading`` | No | No | ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ +| ``ov::hint::enable_cpu_pinning`` | No / Not Supported | Yes except using P-cores and E-cores together | ++--------------------------------------+------------------------------------------------------------------------+--------------------------------------------------------------------+ + +.. note:: + + - ``ov::hint::scheduling_core_type`` may be adjusted for a particular inferred model on a + specific platform based on internal heuristics to guarantee optimal performance. + - Both P-cores and E-cores are used for the Latency Hint on Intel® Core™ Ultra Processors + on Windows, except in the case of large language models. + - In case hyper-threading is enabled, two logical processors share the hardware resources + of one CPU core. OpenVINO does not expect to use both logical processors in one stream + for a single infer request. So ``ov::hint::enable_hyper_threading`` is set to + ``No`` in this scenario. + - ``ov::hint::enable_cpu_pinning`` is disabled by default on Windows and macOS, and + enabled on Linux. Such default settings are aligned with typical workloads running + in the corresponding environments to guarantee better out-of-the-box (OOB) performance. + +Throughput Hint +##################### + +In this scenario, thread scheduling first evaluates the memory pressure of the model being +inferred on the current platform, and determines the number of threads per stream, as shown below. + ++-----------------+-----------------------+ +| Memory Pressure | Threads per Stream | ++=================+=======================+ +| low | 1 P-core or 2 E-cores | ++-----------------+-----------------------+ +| medium | 2 | ++-----------------+-----------------------+ +| high | 3 or 4 or 5 | ++-----------------+-----------------------+ + +Then the value of ``ov::num_streams`` is calculated by dividing ``ov::inference_num_threads`` +by the number of threads per stream. The default settings for low-level performance +properties on Windows and Linux are as follows: + ++--------------------------------------+-------------------------------+-------------------------------+ +| Property | Windows | Linux | ++======================================+===============================+===============================+ +| ``ov::num_streams`` | Calculated as above | Calculated as above | ++--------------------------------------+-------------------------------+-------------------------------+ +| ``ov::inference_num_threads`` | Number of P-cores and E-cores | Number of P-cores and E-cores | ++--------------------------------------+-------------------------------+-------------------------------+ +| ``ov::hint::scheduling_core_type`` | P-cores and E-cores | P-cores and E-cores | ++--------------------------------------+-------------------------------+-------------------------------+ +| ``ov::hint::enable_hyper_threading`` | Yes / No | Yes / No | ++--------------------------------------+-------------------------------+-------------------------------+ +| ``ov::hint::enable_cpu_pinning`` | No | Yes | ++--------------------------------------+-------------------------------+-------------------------------+ + +.. note:: + + By default, different core types are not mixed within a single stream in this scenario. + The cores from different NUMA nodes are not mixed within a single stream. + +Multi-Threading Optimization +############################ + +The following properties can be used to limit the available CPU resources for model inference. +If the platform or operating system supports this behavior, the OpenVINO Runtime will +perform multi-threading scheduling based on the limited available CPU. + +- ``ov::inference_num_threads`` +- ``ov::hint::scheduling_core_type`` +- ``ov::hint::enable_hyper_threading`` + +.. tab-set:: + + .. tab-item:: Python + :sync: py + + .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.py + :language: python + :fragment: [ov:intel_cpu:multi_threading:part0] + + .. tab-item:: C++ + :sync: cpp + + .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.cpp + :language: cpp + :fragment: [ov:intel_cpu:multi_threading:part0] + + +.. note:: + + ``ov::hint::scheduling_core_type`` and ``ov::hint::enable_hyper_threading`` only support + Intel® x86-64 CPU on Linux and Windows in the current release. + +In some use cases, OpenVINO Runtime will enable CPU thread pinning by default for better performance. +Users can also turn this feature on or off using the property ``ov::hint::enable_cpu_pinning``. +Disabling thread pinning may be beneficial in complex applications where several workloads +are executed in parallel. + +.. tab-set:: + + .. tab-item:: Python + :sync: py + + .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.py + :language: python + :fragment: [ov:intel_cpu:multi_threading:part1] + + .. tab-item:: C++ + :sync: cpp + + .. doxygensnippet:: docs/articles_en/assets/snippets/multi_threading.cpp + :language: cpp + :fragment: [ov:intel_cpu:multi_threading:part1] + + +For details on multi-stream execution check the +:doc:`optimization guide <../../optimize-inference/optimizing-throughput/advanced_throughput_options>`. diff --git a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/general-optimizations.rst b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/general-optimizations.rst index d7520f57315..4f37cc35092 100644 --- a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/general-optimizations.rst +++ b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/general-optimizations.rst @@ -62,7 +62,7 @@ Below are example-codes for the regular and async-based approaches to compare: The technique can be generalized to any available parallel slack. For example, you can do inference and simultaneously encode the resulting or previous frames or run further inference, like emotion detection on top of the face detection results. -Refer to the `Object Detection C++ Demo `__ , `Object Detection Python Demo `__ (latency-oriented Async API showcase) and :doc:`Benchmark App Sample <../../../learn-openvino/openvino-samples/benchmark-tool>` for complete examples of the Async API in action. +Refer to the `Object Detection C++ Demo `__ , `Object Detection Python Demo `__ (latency-oriented Async API showcase) and :doc:`Benchmark App Sample <../../../learn-openvino/openvino-samples/benchmark-tool>` for complete examples of the Async API in action. .. note:: diff --git a/docs/articles_en/openvino-workflow/torch-compile.rst b/docs/articles_en/openvino-workflow/torch-compile.rst index 57682f2e143..280b7c01ca1 100644 --- a/docs/articles_en/openvino-workflow/torch-compile.rst +++ b/docs/articles_en/openvino-workflow/torch-compile.rst @@ -22,20 +22,33 @@ By default, Torch code runs in eager-mode, but with the use of ``torch.compile`` How to Use #################### -To use ``torch.compile``, you need to add an import statement and define the ``openvino`` backend. +To use ``torch.compile``, you need to define the ``openvino`` backend in your PyTorch application. This way Torch FX subgraphs will be directly converted to OpenVINO representation without any additional PyTorch-based tracing/scripting. +This approach works only for the **package distributed via pip**, as it is now configured with +`torch_dynamo_backends entrypoint `__. +.. code-block:: python -.. code-block:: sh - - import openvino.torch ... model = torch.compile(model, backend='openvino') + ... + +For OpenVINO installed via channels other than pip, such as conda, and versions older than +2024.1, an additional import statement is needed: + +.. code-block:: python + + import openvino.torch + + ... + model = torch.compile(model, backend='openvino') + ... + -Execution diagram: .. image:: ../assets/images/torch_compile_backend_openvino.svg + :alt: torch.compile execution diagram :width: 992px :height: 720px :scale: 60% @@ -51,6 +64,10 @@ enable model caching, set the cache directory etc. You can use a dictionary of t By default, the OpenVINO backend for ``torch.compile`` runs PyTorch applications on CPU. If you set this variable to ``GPU.0``, for example, the application will use the integrated graphics processor instead. +* ``aot_autograd`` - enables aot_autograd graph capture. The aot_autograd graph capture + is needed to enable dynamic shapes or to finetune a model. For models with dynamic + shapes, it is recommended to set this option to ``True``. By default, aot_autograd + is set to ``False``. * ``model_caching`` - enables saving the optimized model files to a hard drive, after the first application run. This makes them available for the following application executions, reducing the first-inference latency. By default, this @@ -58,6 +75,15 @@ enable model caching, set the cache directory etc. You can use a dictionary of t * ``cache_dir`` - enables defining a custom directory for the model files (if ``model_caching`` is set to ``True``). By default, the OpenVINO IR is saved in the cache sub-directory, created in the application's root directory. +* ``decompositions`` - enables defining additional operator decompositions. By + default, this is an empty list. For example, to add a decomposition for + an operator ``my_op``, add ``'decompositions': [torch.ops.aten.my_op.default]`` + to the options. +* ``disabled_ops`` - enables specifying operators that can be disabled from + openvino execution and make it fall back to native PyTorch runtime. For + example, to disable an operator ``my_op`` from OpenVINO execution, add + ``'disabled_ops': [torch.ops.aten.my_op.default]`` to the options. By + default, this is an empty list. * ``config`` - enables passing any OpenVINO configuration option as a dictionary to this variable. For details on the various options, refer to the :ref:`OpenVINO Advanced Features `. @@ -79,8 +105,10 @@ You can also set OpenVINO specific configuration options by adding them as a dic Windows support +++++++++++++++++++++ -Currently, PyTorch does not support ``torch.compile`` feature on Windows officially. However, it can be accessed by running -the below instructions: +PyTorch supports ``torch.compile`` officially on Windows from version 2.3.0 onwards. + +For PyTorch versions below 2.3.0, the ``torch.compile`` feature is not supported on Windows +officially. However, it can be accessed by running the following instructions: 1. Install the PyTorch nightly wheel file - `2.1.0.dev20230713 `__ , 2. Update the file at ``/Lib/site-packages/torch/_dynamo/eval_frames.py`` @@ -104,6 +132,50 @@ the below instructions: if sys.version_info >= (3, 11): `raise RuntimeError("Python 3.11+ not yet supported for torch.compile") +Support for PyTorch 2 export quantization (Preview) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +PyTorch 2 export quantization is supported by OpenVINO backend in ``torch.compile``. To be able +to access this feature, follow the steps provided in +`PyTorch 2 Export Post Training Quantization with X86 Backend through Inductor `__ +and update the provided sample as explained below. + +1. If you are using PyTorch version 2.3.0 or later, disable constant folding in quantization to + be able to benefit from the optimization in the OpenVINO backend. This can be done by passing + ``fold_quantize=False`` parameter into the ``convert_pt2e`` function. To do so, change this + line: + + .. code-block:: python + + converted_model = convert_pt2e(prepared_model) + + to the following: + + .. code-block:: python + + converted_model = convert_pt2e(prepared_model, fold_quantize=False) + +2. Set ``torch.compile`` backend as OpenVINO and execute the model. + + Update this line below: + + .. code-block:: python + + optimized_model = torch.compile(converted_model) + + As below: + + .. code-block:: python + + optimized_model = torch.compile(converted_model, backend="openvino") + +TorchServe Integration ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TorchServe is a performant, flexible, and easy to use tool for serving PyTorch models in production. For more information on the details of TorchServe, +you can refer to `TorchServe github repository. `__. With OpenVINO ``torch.compile`` integration into TorchServe you can serve +PyTorch models in production and accelerate them with OpenVINO on various Intel hardware. Detailed instructions on how to use OpenVINO with TorchServe are +available in `TorchServe examples. `__ Support for Automatic1111 Stable Diffusion WebUI +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/docs/dev/build_android.md b/docs/dev/build_android.md index 91cd94644a6..8a42fc6f2be 100644 --- a/docs/dev/build_android.md +++ b/docs/dev/build_android.md @@ -5,49 +5,119 @@ This article describes how to build OpenVINO for Android operating systems. ## Software requirements - [CMake](https://cmake.org/download/) 3.13 or higher -- Android NDK (this guide has been validated with r20 release) +- [SCons](https://scons.org/pages/download.html) 4.6.0 or higher +- [Android SDK Platform Tools](https://developer.android.com/tools/releases/platform-tools) (this guide has been validated with 30.0.0 release) +- [Android NDK](https://developer.android.com/ndk/downloads) (this guide has been validated with r26 release) ## How to build -1. Download and unpack [Android NDK](https://developer.android.com/ndk/downloads). Let's assume that `~/Downloads` is used as a working folder. +### Create a work directory ```sh - cd ~/Downloads - wget https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip - - unzip android-ndk-r20-linux-x86_64.zip - mv android-ndk-r20 android-ndk + mkdir openvino-android + export OPV_HOME_DIR=${PWD}/openvino-android ``` -2. Create a build folder: +### Download and unpack Android packages +* Download and unpack [Android NDK](https://developer.android.com/ndk/downloads) ```sh - mkdir build - ``` + wget https://dl.google.com/android/repository/android-ndk-r26d-linux.zip --directory-prefix $OPV_HOME_DIR -3. Change working directory to `build` and run `cmake` to create makefiles. Then run `make`. + unzip $OPV_HOME_DIR/android-ndk-r26d-linux.zip -d $OPV_HOME_DIR + mv $OPV_HOME_DIR/android-ndk-r26d $OPV_HOME_DIR/android-ndk + export ANDROID_NDK_PATH=$OPV_HOME_DIR/android-ndk + ``` +* Download and unpack [Android SDK Platform Tools](https://developer.android.com/tools/releases/platform-tools) ```sh - cd build + wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip --directory-prefix $OPV_HOME_DIR - cmake .. \ - -DCMAKE_TOOLCHAIN_FILE=~/Downloads/android-ndk/build/cmake/android.toolchain.cmake \ - -DANDROID_ABI=x86_64 \ - -DANDROID_PLATFORM=21 \ - -DANDROID_STL=c++_shared - - make --jobs=$(nproc --all) + unzip $OPV_HOME_DIR/platform-tools-latest-linux.zip -d $OPV_HOME_DIR + export ANDROID_TOOLS_PATH=$OPV_HOME_DIR/platform-tools ``` +_For Windows and Mac operating systems, the downloading and unpacking steps are similar._ - * `ANDROID_ABI` specifies target architecture: +### Set the environment variables for building + ```sh + export CURRENT_ANDROID_ABI=`$ANDROID_TOOLS_PATH/adb shell getprop ro.product.cpu.abi` + export CURRENT_ANDROID_PLATFORM=30 + export CURRENT_ANDROID_STL=c++_shared + export CURRENT_CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_PATH/build/cmake/android.toolchain.cmake + ``` +* `ANDROID_ABI` specifies the target architecture: * `x86_64` for x64 build * `armeabi-v7a with NEON` for ARM with NEON support * `arm64-v8a` for ARM 64 bits - * `ANDROID_PLATFORM` - Android API version - * `ANDROID_STL` specifies that shared C++ runtime is used. Copy `~/Downloads/android-ndk/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so` from Android NDK along with built binaries +* `ANDROID_PLATFORM` specifies the Android API version. +* `ANDROID_STL` indicates that a shared C++ runtime is used. -4. To reduce the binaries size, use `strip` tool from NDK: +### Build and install OneTBB™ +To improve the parallelism performance of the OpenVINO™ library using OneTBB, it is required to separately build OneTBB for a specific version of the Android NDK: + ```sh + # Clone OneTBB™ repository + git clone --recursive https://github.com/oneapi-src/oneTBB $OPV_HOME_DIR/one-tbb + # Create build and install directory + mkdir $OPV_HOME_DIR/one-tbb-build $OPV_HOME_DIR/one-tbb-install + # Configure OneTBB™ CMake project + cmake -S $OPV_HOME_DIR/one-tbb \ + -B $OPV_HOME_DIR/one-tbb-build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$OPV_HOME_DIR/one-tbb-install \ + -DCMAKE_TOOLCHAIN_FILE=$CURRENT_CMAKE_TOOLCHAIN_FILE \ + -DANDROID_ABI=$CURRENT_ANDROID_ABI \ + -DANDROID_PLATFORM=$CURRENT_ANDROID_PLATFORM \ + -DANDROID_STL=$CURRENT_ANDROID_STL \ + -DTBB_TEST=OFF \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--undefined-version" + # Build OneTBB™ project + cmake --build $OPV_HOME_DIR/one-tbb-build --parallel + # Install OneTBB™ project + cmake --install $OPV_HOME_DIR/one-tbb-build + ``` -```bash -~/Downloads/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android/bin/strip openvino/bin/intel64/Release/lib/*.so -``` +### Build and install OpenVINO™ + ```sh + # Clone OpenVINO™ repository + git clone --recursive https://github.com/openvinotoolkit/openvino $OPV_HOME_DIR/openvino + # Create build and install directory + mkdir $OPV_HOME_DIR/openvino-build $OPV_HOME_DIR/openvino-install + # Configure OpenVINO™ CMake project + cmake -S $OPV_HOME_DIR/openvino \ + -B $OPV_HOME_DIR/openvino-build \ + -DCMAKE_INSTALL_PREFIX=$OPV_HOME_DIR/openvino-install \ + -DCMAKE_TOOLCHAIN_FILE=$CURRENT_CMAKE_TOOLCHAIN_FILE \ + -DANDROID_ABI=$CURRENT_ANDROID_ABI \ + -DANDROID_PLATFORM=$CURRENT_ANDROID_PLATFORM \ + -DANDROID_STL=$CURRENT_ANDROID_STL \ + -DTBB_DIR=$OPV_HOME_DIR/one-tbb-install/lib/cmake/TBB + # Build OpenVINO™ project + cmake --build $OPV_HOME_DIR/openvino-build --parallel + # Install OpenVINO™ project + cmake --install $OPV_HOME_DIR/openvino-build + ``` + +### Download the example model + We will use `mobelinet-v3-tf` example model + ```sh + mkdir $OPV_HOME_DIR/mobelinet-v3-tf + wget https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/mobelinet-v3-tf/FP32/v3-small_224_1.0_float.xml -P $OPV_HOME_DIR/mobelinet-v3-tf/ + wget https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/mobelinet-v3-tf/FP32/v3-small_224_1.0_float.bin -P $OPV_HOME_DIR/mobelinet-v3-tf/ + ``` + +### Use the ADB tool to run the example model and check the library +_This example is demonstrated for aarch64 architecture_ + ```sh + # Copy OpenVINO™ libraries to android device + $ANDROID_TOOLS_PATH/adb push --sync $OPV_HOME_DIR/openvino-install/runtime/lib/aarch64/* /data/local/tmp/ + # Copy OneTBB libraries to android device + $ANDROID_TOOLS_PATH/adb push --sync $OPV_HOME_DIR/one-tbb-install/lib/* /data/local/tmp/ + # Copy shared STL library to android device + $ANDROID_TOOLS_PATH/adb push --sync $ANDROID_NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp/ + # Copy example model files + $ANDROID_TOOLS_PATH/adb push --sync $OPV_HOME_DIR/mobelinet-v3-tf /data/local/tmp/ + # Copy OpenVINO™ benchmark_app tool to android device + $ANDROID_TOOLS_PATH/adb push --sync $OPV_HOME_DIR/openvino/bin/aarch64/Release/benchmark_app /data/local/tmp/ + # Run OpenVINO™ benchmark_app tool + $ANDROID_TOOLS_PATH/adb shell "LD_LIBRARY_PATH=/data/local/tmp ./data/local/tmp/benchmark_app -m /data/local/tmp/mobelinet-v3-tf/v3-small_224_1.0_float.xml -hint latency" + ``` ## See also @@ -55,4 +125,3 @@ This article describes how to build OpenVINO for Android operating systems. * [OpenVINO Developer Documentation](index.md) * [OpenVINO Get Started](./get_started.md) * [How to build OpenVINO](build.md) - diff --git a/docs/dev/ci/github_actions/overview.md b/docs/dev/ci/github_actions/overview.md index 2a3c3027fe4..05dc980ebb5 100644 --- a/docs/dev/ci/github_actions/overview.md +++ b/docs/dev/ci/github_actions/overview.md @@ -274,7 +274,7 @@ You can run jobs in Docker containers. Refer to [the documentation for syntax overview](https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container). Workflows utilize appropriate Docker images based on their jobs' needs. Learn more about the -available images and how to choose one in the [hOpenVINO Docker Image Overview](./docker_images.md). +available images and how to choose one in the [OpenVINO Docker Image Overview](./docker_images.md). ## Caches diff --git a/docs/dev/ci/github_actions/runners.md b/docs/dev/ci/github_actions/runners.md index 0fac0bed90b..30c85ab4724 100644 --- a/docs/dev/ci/github_actions/runners.md +++ b/docs/dev/ci/github_actions/runners.md @@ -38,7 +38,14 @@ OpenVINO repositories make use of the following runners: ## Available Self-hosted Runners -The self-hosted runners are dynamically spawned for each requested pipeline. +Two groups of self-hosted runners are available: + +* Dynamically-spawned Linux and Windows runners with CPU-only capabilities +* Dedicated Linux runners with GPU capabilities + +### Dynamically-spawned Linux and Windows Runners + +These self-hosted runners are dynamically spawned for each requested pipeline. Several configurations are available, which are identified by different group names. The group names generally follow the pattern: `aks-{OS}-{CORES_N}-cores-|{RAM_SIZE}gb|-|{ARCH}|`, where: @@ -65,6 +72,50 @@ The available configurations are: * `*` - Not specified in the group name +### Dedicated GPU Runners + +Eighteen runners with GPU capabilities (both integrated and discrete, iGPU and dGPU) +are available to all repositories in the OpenVINO organisation's GitHub Actions. + +These runners are virtual machines with Ubuntu 22.04 and have the following specifications: + +* CPU: i9-12900k +* All of them have iGPU (UHD 770 Graphics) +* Twelve of them have iGPU (UHD 770 Graphics) and dGPU (Arc A770) + +These runners may be selected using labels provided in the `runs-on` field in a job configuration. +The available labels are: +* `gpu` - encapsulates all the 18 runners +* `igpu` - encapsulates all the 18 runners as all of them have iGPU +* `dgpu` - encapsulates 12 runners that have dGPU + +Here is an example, a `GPU Tests` job that uses the `gpu` label and runs on any available GPU runner: +```yaml + GPU: + name: GPU Tests + needs: [ Build, Smart_CI ] + runs-on: [ self-hosted, gpu ] + container: + image: ubuntu:20.04 + options: --device /dev/dri:/dev/dri --group-add 109 --group-add 44 + volumes: + - /dev/dri:/dev/dri + ... +``` + +If, for example, a job requires a dGPU, it should use the `dgpu` label, instead: +```yaml + GPU: + name: GPU Tests + needs: [ Build, Smart_CI ] + runs-on: [ self-hosted, dgpu ] + ... +``` + +**NOTE**: as these are persistent runners, Docker should be used for the jobs that utilise the GPU runners. +Learn more about the +available images and how to choose one in the [OpenVINO Docker Image Overview](./docker_images.md). + ## How to Choose a Runner The configuration of a runner required for a job (building, testing, other tasks) depends on the diff --git a/docs/dev/pypi_publish/pypi-openvino-dev.md b/docs/dev/pypi_publish/pypi-openvino-dev.md index 54f94351501..24f9c35b1e4 100644 --- a/docs/dev/pypi_publish/pypi-openvino-dev.md +++ b/docs/dev/pypi_publish/pypi-openvino-dev.md @@ -119,10 +119,10 @@ For example, to install and configure the components for working with TensorFlow **In addition, the openvino-dev package installs the following components by default:** -| Component | Console Script | Description | +| Component | Console Script | Description | |------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Legacy Model conversion API](https://docs.openvino.ai/nightly/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) | `mo` |**Model conversion API** imports, converts, and optimizes models that were trained in popular frameworks to a format usable by OpenVINO components.
Supported frameworks include Caffe\*, TensorFlow\*, MXNet\*, PaddlePaddle\*, and ONNX\*. | | -| [Model Downloader and other Open Model Zoo tools](https://docs.openvino.ai/nightly/omz_tools_downloader.html)| `omz_downloader`
`omz_converter`
`omz_quantizer`
`omz_info_dumper`| **Model Downloader** is a tool for getting access to the collection of high-quality and extremely fast pre-trained deep learning [public](@ref omz_models_group_public) and [Intel](@ref omz_models_group_intel)-trained models. These free pre-trained models can be used to speed up the development and production deployment process without training your own models. The tool downloads model files from online sources and, if necessary, patches them to make them more usable with model conversion API. A number of additional tools are also provided to automate the process of working with downloaded models:
**Model Converter** is a tool for converting Open Model Zoo models that are stored in an original deep learning framework format into the OpenVINO Intermediate Representation (IR) using model conversion API.
**Model Quantizer** is a tool for automatic quantization of full-precision models in the IR format into low-precision versions using the Post-Training Optimization Tool.
**Model Information Dumper** is a helper utility for dumping information about the models to a stable, machine-readable format. | +| [Legacy Model conversion API](https://docs.openvino.ai/2024/documentation/legacy-features/transition-legacy-conversion-api/legacy-conversion-api.html) | `mo` |**Model conversion API** imports, converts, and optimizes models that were trained in popular frameworks to a format usable by OpenVINO components.
Supported frameworks include Caffe\*, TensorFlow\*, MXNet\*, PaddlePaddle\*, and ONNX\*. | | +| [Model Downloader and other Open Model Zoo tools](https://docs.openvino.ai/2024/omz_tools_downloader.html)| `omz_downloader`
`omz_converter`
`omz_quantizer`
`omz_info_dumper`| **Model Downloader** is a tool for getting access to the collection of high-quality and extremely fast pre-trained deep learning [public](@ref omz_models_group_public) and [Intel](@ref omz_models_group_intel)-trained models. These free pre-trained models can be used to speed up the development and production deployment process without training your own models. The tool downloads model files from online sources and, if necessary, patches them to make them more usable with model conversion API. A number of additional tools are also provided to automate the process of working with downloaded models:
**Model Converter** is a tool for converting Open Model Zoo models that are stored in an original deep learning framework format into the OpenVINO Intermediate Representation (IR) using model conversion API.
**Model Quantizer** is a tool for automatic quantization of full-precision models in the IR format into low-precision versions using the Post-Training Optimization Tool.
**Model Information Dumper** is a helper utility for dumping information about the models to a stable, machine-readable format. | ## Troubleshooting diff --git a/docs/home.rst b/docs/home.rst index 08b2e8d62cc..b4f63f81d7d 100644 --- a/docs/home.rst +++ b/docs/home.rst @@ -1,5 +1,5 @@ ============================ -OpenVINO 2024.1 +OpenVINO 2024.2 ============================ .. meta:: diff --git a/docs/nbdoc/consts.py b/docs/nbdoc/consts.py index 6545e590fd0..ded7c9637e0 100644 --- a/docs/nbdoc/consts.py +++ b/docs/nbdoc/consts.py @@ -6,7 +6,7 @@ repo_directory = "notebooks" repo_owner = "openvinotoolkit" repo_name = "openvino_notebooks" repo_branch = "tree/main" -artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240515220822/dist/rst_files/" +artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240605220807/dist/rst_files/" blacklisted_extensions = ['.xml', '.bin'] notebooks_repo = "https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/" notebooks_binder = "https://mybinder.org/v2/gh/openvinotoolkit/openvino_notebooks/HEAD?filepath=" diff --git a/docs/notebooks/3D-pose-estimation-with-output.rst b/docs/notebooks/3D-pose-estimation-with-output.rst index fda23f07b57..8d52a5d3589 100644 --- a/docs/notebooks/3D-pose-estimation-with-output.rst +++ b/docs/notebooks/3D-pose-estimation-with-output.rst @@ -69,82 +69,82 @@ Lab instead.** Collecting openvino-dev>=2024.0.0 Using cached openvino_dev-2024.1.0-15008-py3-none-any.whl.metadata (16 kB) Collecting opencv-python - Using cached opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB) + Using cached opencv_python-4.10.0.82-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB) Collecting torch - Using cached https://download.pytorch.org/whl/cpu/torch-2.3.0%2Bcpu-cp38-cp38-linux_x86_64.whl (190.4 MB) + Using cached https://download.pytorch.org/whl/cpu/torch-2.3.1%2Bcpu-cp38-cp38-linux_x86_64.whl (190.4 MB) Collecting onnx - Using cached onnx-1.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (16 kB) - Requirement already satisfied: ipywidgets>=7.2.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pythreejs) (8.1.2) + Using cached onnx-1.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (16 kB) + Requirement already satisfied: ipywidgets>=7.2.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pythreejs) (8.1.3) Collecting ipydatawidgets>=1.1.1 (from pythreejs) Using cached ipydatawidgets-4.3.5-py2.py3-none-any.whl.metadata (1.4 kB) Collecting numpy (from pythreejs) Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB) - Requirement already satisfied: traitlets in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pythreejs) (5.14.3) - Requirement already satisfied: defusedxml>=0.7.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (0.7.1) + Requirement already satisfied: traitlets in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pythreejs) (5.14.3) + Requirement already satisfied: defusedxml>=0.7.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (0.7.1) Collecting networkx<=3.1.0 (from openvino-dev>=2024.0.0) Using cached networkx-3.1-py3-none-any.whl.metadata (5.3 kB) Collecting openvino-telemetry>=2023.2.1 (from openvino-dev>=2024.0.0) Using cached openvino_telemetry-2024.1.0-py3-none-any.whl.metadata (2.3 kB) - Requirement already satisfied: packaging in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (24.0) - Requirement already satisfied: pyyaml>=5.4.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (6.0.1) - Requirement already satisfied: requests>=2.25.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (2.31.0) + Requirement already satisfied: packaging in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (24.0) + Requirement already satisfied: pyyaml>=5.4.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (6.0.1) + Requirement already satisfied: requests>=2.25.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino-dev>=2024.0.0) (2.32.0) Collecting openvino==2024.1.0 (from openvino-dev>=2024.0.0) Using cached openvino-2024.1.0-15008-cp38-cp38-manylinux2014_x86_64.whl.metadata (8.8 kB) Collecting filelock (from torch) Using cached filelock-3.14.0-py3-none-any.whl.metadata (2.8 kB) - Requirement already satisfied: typing-extensions>=4.8.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from torch) (4.11.0) + Requirement already satisfied: typing-extensions>=4.8.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from torch) (4.12.1) Collecting sympy (from torch) - Using cached https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB) - Requirement already satisfied: jinja2 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from torch) (3.1.4) + Using cached sympy-1.12.1-py3-none-any.whl.metadata (12 kB) + Requirement already satisfied: jinja2 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from torch) (3.1.4) Collecting fsspec (from torch) - Downloading fsspec-2024.5.0-py3-none-any.whl.metadata (11 kB) + Using cached fsspec-2024.6.0-py3-none-any.whl.metadata (11 kB) Collecting protobuf>=3.20.2 (from onnx) - Using cached protobuf-5.26.1-cp37-abi3-manylinux2014_x86_64.whl.metadata (592 bytes) + Using cached protobuf-5.27.0-cp38-abi3-manylinux2014_x86_64.whl.metadata (592 bytes) Collecting traittypes>=0.2.0 (from ipydatawidgets>=1.1.1->pythreejs) Using cached traittypes-0.2.1-py2.py3-none-any.whl.metadata (1.0 kB) - Requirement already satisfied: comm>=0.1.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (0.2.2) - Requirement already satisfied: ipython>=6.1.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (8.12.3) - Requirement already satisfied: widgetsnbextension~=4.0.10 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (4.0.10) - Requirement already satisfied: jupyterlab-widgets~=3.0.10 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (3.0.10) - Requirement already satisfied: charset-normalizer<4,>=2 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (3.3.2) - Requirement already satisfied: idna<4,>=2.5 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (3.7) - Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (2.2.1) - Requirement already satisfied: certifi>=2017.4.17 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (2024.2.2) - Requirement already satisfied: MarkupSafe>=2.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from jinja2->torch) (2.1.5) - Collecting mpmath>=0.19 (from sympy->torch) + Requirement already satisfied: comm>=0.1.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (0.2.2) + Requirement already satisfied: ipython>=6.1.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (8.12.3) + Requirement already satisfied: widgetsnbextension~=4.0.11 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (4.0.11) + Requirement already satisfied: jupyterlab-widgets~=3.0.11 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipywidgets>=7.2.1->pythreejs) (3.0.11) + Requirement already satisfied: charset-normalizer<4,>=2 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (3.3.2) + Requirement already satisfied: idna<4,>=2.5 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (3.7) + Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (2.2.1) + Requirement already satisfied: certifi>=2017.4.17 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from requests>=2.25.1->openvino-dev>=2024.0.0) (2024.6.2) + Requirement already satisfied: MarkupSafe>=2.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from jinja2->torch) (2.1.5) + Collecting mpmath<1.4.0,>=1.1.0 (from sympy->torch) Using cached https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB) - Requirement already satisfied: backcall in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.0) - Requirement already satisfied: decorator in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (5.1.1) - Requirement already satisfied: jedi>=0.16 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.19.1) - Requirement already satisfied: matplotlib-inline in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.1.7) - Requirement already satisfied: pickleshare in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.7.5) - Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (3.0.43) - Requirement already satisfied: pygments>=2.4.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.18.0) - Requirement already satisfied: stack-data in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.6.3) - Requirement already satisfied: pexpect>4.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (4.9.0) - Requirement already satisfied: parso<0.9.0,>=0.8.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.8.4) - Requirement already satisfied: ptyprocess>=0.5 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pexpect>4.3->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.7.0) - Requirement already satisfied: wcwidth in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.13) - Requirement already satisfied: executing>=1.2.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.0.1) - Requirement already satisfied: asttokens>=2.1.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.4.1) - Requirement already satisfied: pure-eval in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.2) - Requirement already satisfied: six>=1.12.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from asttokens>=2.1.0->stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (1.16.0) + Requirement already satisfied: backcall in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.0) + Requirement already satisfied: decorator in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (5.1.1) + Requirement already satisfied: jedi>=0.16 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.19.1) + Requirement already satisfied: matplotlib-inline in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.1.7) + Requirement already satisfied: pickleshare in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.7.5) + Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (3.0.46) + Requirement already satisfied: pygments>=2.4.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.18.0) + Requirement already satisfied: stack-data in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.6.3) + Requirement already satisfied: pexpect>4.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (4.9.0) + Requirement already satisfied: parso<0.9.0,>=0.8.3 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.8.4) + Requirement already satisfied: ptyprocess>=0.5 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from pexpect>4.3->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.7.0) + Requirement already satisfied: wcwidth in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.13) + Requirement already satisfied: executing>=1.2.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.0.1) + Requirement already satisfied: asttokens>=2.1.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (2.4.1) + Requirement already satisfied: pure-eval in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (0.2.2) + Requirement already satisfied: six>=1.12.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from asttokens>=2.1.0->stack-data->ipython>=6.1.0->ipywidgets>=7.2.1->pythreejs) (1.16.0) Using cached pythreejs-2.4.2-py3-none-any.whl (3.4 MB) Using cached openvino_dev-2024.1.0-15008-py3-none-any.whl (4.7 MB) Using cached openvino-2024.1.0-15008-cp38-cp38-manylinux2014_x86_64.whl (38.7 MB) - Using cached opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (62.2 MB) - Using cached onnx-1.16.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB) + Using cached opencv_python-4.10.0.82-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (62.5 MB) + Using cached onnx-1.16.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB) Using cached ipydatawidgets-4.3.5-py2.py3-none-any.whl (271 kB) Using cached networkx-3.1-py3-none-any.whl (2.1 MB) Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB) Using cached openvino_telemetry-2024.1.0-py3-none-any.whl (23 kB) - Using cached protobuf-5.26.1-cp37-abi3-manylinux2014_x86_64.whl (302 kB) + Using cached protobuf-5.27.0-cp38-abi3-manylinux2014_x86_64.whl (309 kB) Using cached filelock-3.14.0-py3-none-any.whl (12 kB) - Downloading fsspec-2024.5.0-py3-none-any.whl (316 kB) -  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 316.1/316.1 kB 2.6 MB/s eta 0:00:00 + Using cached fsspec-2024.6.0-py3-none-any.whl (176 kB) + Using cached sympy-1.12.1-py3-none-any.whl (5.7 MB) Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB) Installing collected packages: openvino-telemetry, mpmath, traittypes, sympy, protobuf, numpy, networkx, fsspec, filelock, torch, openvino, opencv-python, onnx, openvino-dev, ipydatawidgets, pythreejs - Successfully installed filelock-3.14.0 fsspec-2024.5.0 ipydatawidgets-4.3.5 mpmath-1.3.0 networkx-3.1 numpy-1.24.4 onnx-1.16.0 opencv-python-4.9.0.80 openvino-2024.1.0 openvino-dev-2024.1.0 openvino-telemetry-2024.1.0 protobuf-5.26.1 pythreejs-2.4.2 sympy-1.12 torch-2.3.0+cpu traittypes-0.2.1 + Successfully installed filelock-3.14.0 fsspec-2024.6.0 ipydatawidgets-4.3.5 mpmath-1.3.0 networkx-3.1 numpy-1.24.4 onnx-1.16.1 opencv-python-4.10.0.82 openvino-2024.1.0 openvino-dev-2024.1.0 openvino-telemetry-2024.1.0 protobuf-5.27.0 pythreejs-2.4.2 sympy-1.12.1 torch-2.3.1+cpu traittypes-0.2.1 Note: you may need to restart the kernel to use updated packages. @@ -252,18 +252,18 @@ IR format. .. parsed-literal:: ========== Converting human-pose-estimation-3d-0001 to ONNX - Conversion to ONNX command: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/bin/python -- /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/omz_tools/internal_scripts/pytorch_to_onnx.py --model-path=model/public/human-pose-estimation-3d-0001 --model-name=PoseEstimationWithMobileNet --model-param=is_convertible_by_mo=True --import-module=model --weights=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.pth --input-shape=1,3,256,448 --input-names=data --output-names=features,heatmaps,pafs --output-file=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.onnx + Conversion to ONNX command: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/bin/python -- /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/omz_tools/internal_scripts/pytorch_to_onnx.py --model-path=model/public/human-pose-estimation-3d-0001 --model-name=PoseEstimationWithMobileNet --model-param=is_convertible_by_mo=True --import-module=model --weights=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.pth --input-shape=1,3,256,448 --input-names=data --output-names=features,heatmaps,pafs --output-file=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.onnx ONNX check passed successfully. ========== Converting human-pose-estimation-3d-0001 to IR (FP32) - Conversion command: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/bin/python -- /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/bin/mo --framework=onnx --output_dir=model/public/human-pose-estimation-3d-0001/FP32 --model_name=human-pose-estimation-3d-0001 --input=data '--mean_values=data[128.0,128.0,128.0]' '--scale_values=data[255.0,255.0,255.0]' --output=features,heatmaps,pafs --input_model=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.onnx '--layout=data(NCHW)' '--input_shape=[1, 3, 256, 448]' --compress_to_fp16=False + Conversion command: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/bin/python -- /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/bin/mo --framework=onnx --output_dir=model/public/human-pose-estimation-3d-0001/FP32 --model_name=human-pose-estimation-3d-0001 --input=data '--mean_values=data[128.0,128.0,128.0]' '--scale_values=data[255.0,255.0,255.0]' --output=features,heatmaps,pafs --input_model=model/public/human-pose-estimation-3d-0001/human-pose-estimation-3d-0001.onnx '--layout=data(NCHW)' '--input_shape=[1, 3, 256, 448]' --compress_to_fp16=False [ INFO ] MO command line tool is considered as the legacy conversion API as of OpenVINO 2023.2 release. Please use OpenVINO Model Converter (OVC). OVC represents a lightweight alternative of MO and provides simplified model conversion API. Find more information about transition from MO to OVC at https://docs.openvino.ai/2023.2/openvino_docs_OV_Converter_UG_prepare_model_convert_model_MO_OVC_transition.html [ SUCCESS ] Generated IR version 11 model. - [ SUCCESS ] XML file: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/3D-pose-estimation-webcam/model/public/human-pose-estimation-3d-0001/FP32/human-pose-estimation-3d-0001.xml - [ SUCCESS ] BIN file: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/3D-pose-estimation-webcam/model/public/human-pose-estimation-3d-0001/FP32/human-pose-estimation-3d-0001.bin + [ SUCCESS ] XML file: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/3D-pose-estimation-webcam/model/public/human-pose-estimation-3d-0001/FP32/human-pose-estimation-3d-0001.xml + [ SUCCESS ] BIN file: /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/3D-pose-estimation-webcam/model/public/human-pose-estimation-3d-0001/FP32/human-pose-estimation-3d-0001.bin diff --git a/docs/notebooks/3D-segmentation-point-clouds-with-output.rst b/docs/notebooks/3D-segmentation-point-clouds-with-output.rst index 6447ad00919..8e4954bc00a 100644 --- a/docs/notebooks/3D-segmentation-point-clouds-with-output.rst +++ b/docs/notebooks/3D-segmentation-point-clouds-with-output.rst @@ -216,7 +216,7 @@ chair for example. .. parsed-literal:: - /tmp/ipykernel_16799/2434168836.py:12: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored + /tmp/ipykernel_3063563/2434168836.py:12: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter3D(X, Y, Z, s=5, cmap="jet", marker="o", label="chair") @@ -317,7 +317,7 @@ select device from dropdown list for running inference using OpenVINO .. parsed-literal:: - /tmp/ipykernel_16799/2804603389.py:23: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored + /tmp/ipykernel_3063563/2804603389.py:23: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(XCur, YCur, ZCur, s=5, cmap="jet", marker="o", label=classes[i]) diff --git a/docs/notebooks/action-recognition-webcam-with-output_files/action-recognition-webcam-with-output_22_0.png b/docs/notebooks/action-recognition-webcam-with-output_files/action-recognition-webcam-with-output_22_0.png index 29fb7787324..acae41e0b1a 100644 --- a/docs/notebooks/action-recognition-webcam-with-output_files/action-recognition-webcam-with-output_22_0.png +++ b/docs/notebooks/action-recognition-webcam-with-output_files/action-recognition-webcam-with-output_22_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f9f7a4ff050de5ac1c035ff13546573f526abbc3d4b1e157edb3a278caba746 -size 69060 +oid sha256:f9519b2a12072147ebf54e1d7a840ccde81b965fa1844f42f79e66c6513d844a +size 68147 diff --git a/docs/notebooks/all_notebooks_paths.txt b/docs/notebooks/all_notebooks_paths.txt index ebe064c809a..481450364a1 100644 --- a/docs/notebooks/all_notebooks_paths.txt +++ b/docs/notebooks/all_notebooks_paths.txt @@ -15,6 +15,7 @@ notebooks/convert-to-openvino/convert-to-openvino.ipynb notebooks/convert-to-openvino/legacy-mo-convert-to-openvino.ipynb notebooks/cross-lingual-books-alignment/cross-lingual-books-alignment.ipynb notebooks/ct-segmentation-quantize/ct-segmentation-quantize-nncf.ipynb +notebooks/ddcolor-image-colorization/ddcolor-image-colorization.ipynb notebooks/decidiffusion-image-generation/decidiffusion-image-generation.ipynb notebooks/depth-anything/depth-anything.ipynb notebooks/detectron2-to-openvino/detectron2-to-openvino.ipynb @@ -63,6 +64,7 @@ notebooks/model-server/model-server.ipynb notebooks/model-tools/model-tools.ipynb notebooks/music-generation/music-generation.ipynb notebooks/named-entity-recognition/named-entity-recognition.ipynb +notebooks/nano-llava-multimodal-chatbot/nano-llava-multimodal-chatbot.ipynb notebooks/object-detection-webcam/object-detection.ipynb notebooks/oneformer-segmentation/oneformer-segmentation.ipynb notebooks/openvino-api/openvino-api.ipynb @@ -73,6 +75,7 @@ notebooks/optimize-preprocessing/optimize-preprocessing.ipynb notebooks/paddle-ocr-webcam/paddle-ocr-webcam.ipynb notebooks/paddle-to-openvino/paddle-to-openvino-classification.ipynb notebooks/paint-by-example/paint-by-example.ipynb +notebooks/person-counting-webcam/person-counting.ipynb notebooks/person-tracking-webcam/person-tracking.ipynb notebooks/photo-maker/photo-maker.ipynb notebooks/pix2struct-docvqa/pix2struct-docvqa.ipynb @@ -80,6 +83,7 @@ notebooks/pose-estimation-webcam/pose-estimation.ipynb notebooks/pyannote-speaker-diarization/pyannote-speaker-diarization.ipynb notebooks/pytorch-post-training-quantization-nncf/pytorch-post-training-quantization-nncf.ipynb notebooks/pytorch-quantization-aware-training/pytorch-quantization-aware-training.ipynb +notebooks/pytorch-quantization-sparsity-aware-training/pytorch-quantization-sparsity-aware-training.ipynb notebooks/pytorch-to-openvino/pytorch-onnx-to-openvino.ipynb notebooks/pytorch-to-openvino/pytorch-to-openvino.ipynb notebooks/qrcode-monster/qrcode-monster.ipynb @@ -87,6 +91,7 @@ notebooks/quantizing-model-with-accuracy-control/speech-recognition-quantization notebooks/quantizing-model-with-accuracy-control/yolov8-quantization-with-accuracy-control.ipynb notebooks/riffusion-text-to-music/riffusion-text-to-music.ipynb notebooks/rmbg-background-removal/rmbg-background-removal.ipynb +notebooks/s3d-mil-nce-text-to-video-retrieval/s3d-mil-nce-text-to-video-retrieval.ipynb notebooks/sdxl-turbo/sdxl-turbo.ipynb notebooks/segment-anything/segment-anything.ipynb notebooks/siglip-zero-shot-image-classification/siglip-zero-shot-image-classification.ipynb @@ -135,6 +140,7 @@ notebooks/vision-paddlegan-superresolution/vision-paddlegan-superresolution.ipyn notebooks/whisper-subtitles-generation/whisper-convert.ipynb notebooks/whisper-subtitles-generation/whisper-nncf-quantize.ipynb notebooks/wuerstchen-image-generation/wuerstchen-image-generation.ipynb +notebooks/yolov10-optimization/yolov10-optimization.ipynb notebooks/yolov7-optimization/yolov7-optimization.ipynb notebooks/yolov8-optimization/yolov8-instance-segmentation.ipynb notebooks/yolov8-optimization/yolov8-keypoint-detection.ipynb diff --git a/docs/notebooks/amused-lightweight-text-to-image-with-output.rst b/docs/notebooks/amused-lightweight-text-to-image-with-output.rst index d44c1c23128..4619212090a 100644 --- a/docs/notebooks/amused-lightweight-text-to-image-with-output.rst +++ b/docs/notebooks/amused-lightweight-text-to-image-with-output.rst @@ -78,8 +78,8 @@ Load and run the original pipeline .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`. - warnings.warn( + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/transformers/transformer_2d.py:34: FutureWarning: `Transformer2DModelOutput` is deprecated and will be removed in version 1.0.0. Importing `Transformer2DModelOutput` from `diffusers.models.transformer_2d` is deprecated and this will be removed in a future version. Please use `from diffusers.models.modeling_outputs import Transformer2DModelOutput`, instead. + deprecate("Transformer2DModelOutput", "1.0.0", deprecation_message) @@ -202,29 +202,29 @@ Convert the Text Encoder .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_utils.py:4371: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_utils.py:4481: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead warnings.warn( - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_attn_mask_utils.py:86: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_attn_mask_utils.py:86: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if input_shape[-1] > 1 or self.sliding_window is not None: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_attn_mask_utils.py:162: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_attn_mask_utils.py:162: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if past_key_values_length > 0: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:620: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:622: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! encoder_states = () if output_hidden_states else None - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:625: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:627: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if output_hidden_states: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:279: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:276: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if attn_weights.size() != (bsz * self.num_heads, tgt_len, src_len): - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:287: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:284: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if causal_attention_mask.size() != (bsz, 1, tgt_len, src_len): - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:319: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:316: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if attn_output.size() != (bsz * self.num_heads, tgt_len, self.head_dim): - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:648: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:650: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if output_hidden_states: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:651: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:653: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not return_dict: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:742: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:745: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not return_dict: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:1227: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py:1230: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not return_dict: @@ -333,13 +333,13 @@ suitable. This function repeats part of ``AmusedPipeline``. .. parsed-literal:: - /tmp/ipykernel_17572/3779428577.py:34: TracerWarning: Converting a tensor to a Python list might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /tmp/ipykernel_3064357/3779428577.py:34: TracerWarning: Converting a tensor to a Python list might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! shape=shape.tolist(), - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/vq_model.py:144: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/vq_model.py:144: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not force_not_quantize: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/upsampling.py:149: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/upsampling.py:146: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert hidden_states.shape[1] == self.channels - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/upsampling.py:165: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/models/upsampling.py:162: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if hidden_states.shape[0] >= 64: @@ -477,7 +477,7 @@ And insert wrappers instances in the pipeline: .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:139: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:140: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False) @@ -541,12 +541,8 @@ improve model inference speed. QUANTIZED_TRANSFORMER_OV_PATH = Path(str(TRANSFORMER_OV_PATH).replace(".xml", "_quantized.xml")) - to_quantize = widgets.Checkbox( - value=True, - description="Quantization", - disabled=False, - ) - + skip_for_device = "GPU" in device.value + to_quantize = widgets.Checkbox(value=not skip_for_device, description="Quantization", disabled=skip_for_device) to_quantize @@ -692,7 +688,7 @@ model. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/datasets/load.py:1486: FutureWarning: The repository for conceptual_captions contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at https://hf.co/datasets/conceptual_captions + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/datasets/load.py:1491: FutureWarning: The repository for conceptual_captions contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at https://hf.co/datasets/conceptual_captions You can avoid this message in future by passing the argument `trust_remote_code=True`. Passing `trust_remote_code=True` will be mandatory to load this dataset from the next major release of `datasets`. warnings.warn( @@ -706,7 +702,7 @@ model. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:139: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:140: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False) @@ -784,17 +780,17 @@ model. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/experimental/tensor/tensor.py:84: RuntimeWarning: invalid value encountered in multiply return Tensor(self.data * unwrap_tensor_data(other)) @@ -826,7 +822,7 @@ Demo generation with quantized pipeline .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:139: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:140: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False) @@ -910,7 +906,11 @@ a rough estimate of generation quality. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torchmetrics/utilities/prints.py:43: UserWarning: Metric `InceptionScore` will save all extracted features in buffer. For large datasets this may lead to large memory footprint. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/datasets/load.py:1491: FutureWarning: The repository for conceptual_captions contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at https://hf.co/datasets/conceptual_captions + You can avoid this message in future by passing the argument `trust_remote_code=True`. + Passing `trust_remote_code=True` will be mandatory to load this dataset from the next major release of `datasets`. + warnings.warn( + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torchmetrics/utilities/prints.py:43: UserWarning: Metric `InceptionScore` will save all extracted features in buffer. For large datasets this may lead to large memory footprint. warnings.warn(\*args, \*\*kwargs) # noqa: B028 @@ -922,9 +922,9 @@ a rough estimate of generation quality. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:139: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/configuration_utils.py:140: FutureWarning: Accessing config attribute `_execution_device` directly via 'AmusedPipeline' object attribute is deprecated. Please access '_execution_device' over 'AmusedPipeline's config object instead, e.g. 'scheduler.config._execution_device'. deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False) - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torchmetrics/image/inception.py:176: UserWarning: std(): degrees of freedom is <= 0. Correction should be strictly less than the reduction factor (input numel divided by output numel). (Triggered internally at ../aten/src/ATen/native/ReduceOps.cpp:1807.) + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torchmetrics/image/inception.py:176: UserWarning: std(): degrees of freedom is <= 0. Correction should be strictly less than the reduction factor (input numel divided by output numel). (Triggered internally at ../aten/src/ATen/native/ReduceOps.cpp:1807.) return kl.mean(), kl.std() diff --git a/docs/notebooks/animate-anyone-with-output.rst b/docs/notebooks/animate-anyone-with-output.rst index c07b1321d80..9312ff261b1 100644 --- a/docs/notebooks/animate-anyone-with-output.rst +++ b/docs/notebooks/animate-anyone-with-output.rst @@ -64,7 +64,8 @@ Table of contents: - `Video post-processing <#video-post-processing>`__ - `Interactive inference <#interactive-inference>`__ -.. |image0| image:: https://github.com/openvinotoolkit/openvino_notebooks/raw/latest/notebooks/animate-anyone/animate-anyone.gif +.. |image0| image:: https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/animate-anyone/animate-anyone.gif + Prerequisites ------------- @@ -153,11 +154,11 @@ Note that we clone a fork of original repo with tweaked forward methods. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. torch.utils._pytree._register_pytree_node( - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. torch.utils._pytree._register_pytree_node( - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. torch.utils._pytree._register_pytree_node( @@ -278,13 +279,13 @@ Download weights .. parsed-literal:: - diffusion_pytorch_model.bin: 0%| | 0.00/335M [00:00`__. -.. |image1| image:: https://humanaigc.github.io/animate-anyone/static/images/f2_img.png +.. |image01| image:: https://humanaigc.github.io/animate-anyone/static/images/f2_img.png .. code:: ipython3 @@ -502,7 +503,7 @@ of the pipeline, it will be better to convert them to separate models. .. parsed-literal:: - WARNING:nncf:NNCF provides best results with torch==2.2.*, while current torch version is 2.3.0+cpu. If you encounter issues, consider switching to torch==2.2.* + WARNING:nncf:NNCF provides best results with torch==2.2.*, while current torch version is 2.3.1+cpu. If you encounter issues, consider switching to torch==2.2.* INFO:nncf:Statistics of the bitwidth distribution: ┍━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑ │ Num bits (N) │ % all parameters (layers) │ % ratio-defining parameters (layers) │ @@ -839,7 +840,7 @@ required for both reference and denoising UNets. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_utils.py:4371: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/modeling_utils.py:4481: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead warnings.warn( @@ -1210,7 +1211,7 @@ Video post-processing .. raw:: html diff --git a/docs/notebooks/async-api-with-output.rst b/docs/notebooks/async-api-with-output.rst index b7d53ad0cd1..73435822bba 100644 --- a/docs/notebooks/async-api-with-output.rst +++ b/docs/notebooks/async-api-with-output.rst @@ -352,7 +352,7 @@ Test performance in Sync Mode .. parsed-literal:: Source ended - average throuput in sync mode: 43.35 fps + average throuput in sync mode: 60.54 fps Async Mode @@ -491,7 +491,7 @@ Test the performance in Async Mode .. parsed-literal:: Source ended - average throuput in async mode: 73.97 fps + average throuput in async mode: 103.70 fps Compare the performance @@ -634,5 +634,5 @@ Test the performance with ``AsyncInferQueue`` .. parsed-literal:: - average throughput in async mode with async infer queue: 111.33 fps + average throughput in async mode with async infer queue: 148.11 fps diff --git a/docs/notebooks/async-api-with-output_files/async-api-with-output_23_0.png b/docs/notebooks/async-api-with-output_files/async-api-with-output_23_0.png index 07fc6bb0553..589ab949487 100644 --- a/docs/notebooks/async-api-with-output_files/async-api-with-output_23_0.png +++ b/docs/notebooks/async-api-with-output_files/async-api-with-output_23_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6eb6b07a2e43cfab480087829f6babef1e7050550997c85a7a6824f8c308cc3 -size 30403 +oid sha256:0d82d618fb2b2ef25ecd8ad941de1d1173b3e21a3340314cc584dca9b32d6c55 +size 29416 diff --git a/docs/notebooks/auto-device-with-output.rst b/docs/notebooks/auto-device-with-output.rst index 06c0ef2defb..d05af42d516 100644 --- a/docs/notebooks/auto-device-with-output.rst +++ b/docs/notebooks/auto-device-with-output.rst @@ -96,7 +96,7 @@ Import modules and create Core core = ov.Core() - if "GPU" not in core.available_devices: + if not any("GPU" in device for device in core.available_devices): display( Markdown( '
Warning: A GPU device is not available. This notebook requires GPU device to have meaningful results.
' @@ -186,15 +186,15 @@ By default, ``compile_model`` API will select **AUTO** as .. parsed-literal:: - [23:28:01.3129]I[plugin.cpp:418][AUTO] device:CPU, config:LOG_LEVEL=LOG_INFO - [23:28:01.3129]I[plugin.cpp:418][AUTO] device:CPU, config:PERFORMANCE_HINT=LATENCY - [23:28:01.3130]I[plugin.cpp:418][AUTO] device:CPU, config:PERFORMANCE_HINT_NUM_REQUESTS=0 - [23:28:01.3130]I[plugin.cpp:418][AUTO] device:CPU, config:PERF_COUNT=NO - [23:28:01.3130]I[plugin.cpp:423][AUTO] device:CPU, priority:0 - [23:28:01.3130]I[schedule.cpp:17][AUTO] scheduler starting - [23:28:01.3130]I[auto_schedule.cpp:131][AUTO] select device:CPU - [23:28:01.4657]I[auto_schedule.cpp:109][AUTO] device:CPU compiling model finished - [23:28:01.4659]I[plugin.cpp:451][AUTO] underlying hardware does not support hardware context + [23:27:27.6972]I[plugin.cpp:418][AUTO] device:CPU, config:LOG_LEVEL=LOG_INFO + [23:27:27.6973]I[plugin.cpp:418][AUTO] device:CPU, config:PERFORMANCE_HINT=LATENCY + [23:27:27.6973]I[plugin.cpp:418][AUTO] device:CPU, config:PERFORMANCE_HINT_NUM_REQUESTS=0 + [23:27:27.6973]I[plugin.cpp:418][AUTO] device:CPU, config:PERF_COUNT=NO + [23:27:27.6973]I[plugin.cpp:423][AUTO] device:CPU, priority:0 + [23:27:27.6973]I[schedule.cpp:17][AUTO] scheduler starting + [23:27:27.6973]I[auto_schedule.cpp:131][AUTO] select device:CPU + [23:27:27.8462]I[auto_schedule.cpp:109][AUTO] device:CPU compiling model finished + [23:27:27.8464]I[plugin.cpp:451][AUTO] underlying hardware does not support hardware context Successfully compiled model without a device_name. @@ -208,7 +208,7 @@ By default, ``compile_model`` API will select **AUTO** as .. parsed-literal:: Deleted compiled_model - [23:28:01.4767]I[schedule.cpp:303][AUTO] scheduler ending + [23:27:27.8575]I[schedule.cpp:303][AUTO] scheduler ending Explicitly pass AUTO as device_name to Core::compile_model API @@ -318,7 +318,7 @@ Load the model to GPU device and perform inference .. code:: ipython3 - if "GPU" not in core.available_devices: + if not any("GPU" in device for device in core.available_devices): print(f"A GPU device is not available. Available devices are: {core.available_devices}") else: # Start time. @@ -366,7 +366,7 @@ executed on CPU until GPU is ready. .. parsed-literal:: - Time to load model using AUTO device and get first inference: 0.18 seconds. + Time to load model using AUTO device and get first inference: 0.16 seconds. .. code:: ipython3 @@ -538,12 +538,12 @@ Loop for inference and update the FPS/Latency every Compiling Model for AUTO device with THROUGHPUT hint Start inference, 6 groups of FPS/latency will be measured over 10s intervals - throughput: 177.51fps, latency: 32.04ms, time interval: 10.01s - throughput: 179.73fps, latency: 32.54ms, time interval: 10.01s - throughput: 178.74fps, latency: 32.73ms, time interval: 10.01s - throughput: 179.46fps, latency: 32.59ms, time interval: 10.01s - throughput: 178.98fps, latency: 32.74ms, time interval: 10.02s - throughput: 178.58fps, latency: 32.79ms, time interval: 10.01s + throughput: 177.73fps, latency: 32.02ms, time interval: 10.01s + throughput: 179.52fps, latency: 32.63ms, time interval: 10.00s + throughput: 178.56fps, latency: 32.79ms, time interval: 10.00s + throughput: 177.70fps, latency: 32.99ms, time interval: 10.01s + throughput: 178.80fps, latency: 32.69ms, time interval: 10.02s + throughput: 177.72fps, latency: 33.00ms, time interval: 10.01s Done @@ -589,12 +589,12 @@ Loop for inference and update the FPS/Latency for each Compiling Model for AUTO Device with LATENCY hint Start inference, 6 groups fps/latency will be out with 10s interval - throughput: 136.40fps, latency: 6.83ms, time interval: 10.01s - throughput: 137.96fps, latency: 6.81ms, time interval: 10.00s - throughput: 137.97fps, latency: 6.80ms, time interval: 10.00s - throughput: 137.97fps, latency: 6.80ms, time interval: 10.00s - throughput: 138.06fps, latency: 6.80ms, time interval: 10.00s - throughput: 133.29fps, latency: 7.06ms, time interval: 10.01s + throughput: 135.52fps, latency: 6.87ms, time interval: 10.01s + throughput: 137.89fps, latency: 6.85ms, time interval: 10.00s + throughput: 137.71fps, latency: 6.82ms, time interval: 10.01s + throughput: 137.83fps, latency: 6.83ms, time interval: 10.01s + throughput: 137.80fps, latency: 6.83ms, time interval: 10.01s + throughput: 138.34fps, latency: 6.84ms, time interval: 10.00s Done diff --git a/docs/notebooks/auto-device-with-output_files/auto-device-with-output_27_0.png b/docs/notebooks/auto-device-with-output_files/auto-device-with-output_27_0.png index dbe3a0edb38..9e2d67fe539 100644 --- a/docs/notebooks/auto-device-with-output_files/auto-device-with-output_27_0.png +++ b/docs/notebooks/auto-device-with-output_files/auto-device-with-output_27_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d644b71f335dd26763dfad14f93ba1ff32ffe30cfdbe3ac06d1c7346aaba3985 -size 27550 +oid sha256:50f5fe192a152bfb8036a782ee93ab26543c9a30fc626e67aab5e5a7dba9e35a +size 27240 diff --git a/docs/notebooks/auto-device-with-output_files/auto-device-with-output_28_0.png b/docs/notebooks/auto-device-with-output_files/auto-device-with-output_28_0.png index 0e617d97958..1f42981e0fb 100644 --- a/docs/notebooks/auto-device-with-output_files/auto-device-with-output_28_0.png +++ b/docs/notebooks/auto-device-with-output_files/auto-device-with-output_28_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3e6b932de9fd81a384cccede0ed571c920f68e6a9176ce2d84cee626bb03f05 -size 40115 +oid sha256:5a4bfe1e79236b08d4848e6ff59eccf1e2c459d74cb8940b54e8cad3ef01a948 +size 40033 diff --git a/docs/notebooks/clip-zero-shot-classification-with-output.rst b/docs/notebooks/clip-zero-shot-classification-with-output.rst index 495813ec267..40cca0e2ec9 100644 --- a/docs/notebooks/clip-zero-shot-classification-with-output.rst +++ b/docs/notebooks/clip-zero-shot-classification-with-output.rst @@ -102,9 +102,9 @@ tokenizer and preparing the images. .. code:: ipython3 import platform - + %pip install -q --extra-index-url https://download.pytorch.org/whl/cpu "gradio>=4.19" "openvino>=2023.1.0" "transformers[torch]>=4.30" "datasets" "nncf>=2.6.0" "torch>=2.1" Pillow - + if platform.system() != "Windows": %pip install -q "matplotlib>=3.4" else: @@ -119,7 +119,7 @@ tokenizer and preparing the images. .. code:: ipython3 from transformers import CLIPProcessor, CLIPModel - + # load pre-trained model model = CLIPModel.from_pretrained("openai/clip-vit-base-patch16") # load preprocessor for model input @@ -141,8 +141,8 @@ tokenizer and preparing the images. import matplotlib.pyplot as plt import numpy as np from PIL import Image - - + + def visualize_result(image: Image, labels: List[str], probs: np.ndarray, top: int = 5): """ Utility function for visualization classification results @@ -160,7 +160,7 @@ tokenizer and preparing the images. plt.subplot(8, 8, 1) plt.imshow(image) plt.axis("off") - + plt.subplot(8, 8, 2) y = np.arange(top_probs.shape[-1]) plt.grid() @@ -189,17 +189,17 @@ similarity score for the final result. import requests from pathlib import Path - - + + sample_path = Path("data/coco.jpg") sample_path.parent.mkdir(parents=True, exist_ok=True) r = requests.get("https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/coco.jpg") - + with sample_path.open("wb") as f: f.write(r.content) - + image = Image.open(sample_path) - + input_labels = [ "cat", "dog", @@ -213,9 +213,9 @@ similarity score for the final result. "computer", ] text_descriptions = [f"This is a photo of a {label}" for label in input_labels] - + inputs = processor(text=text_descriptions, images=[image], return_tensors="pt", padding=True) - + results = model(**inputs) logits_per_image = results["logits_per_image"] # this is the image-text similarity score probs = logits_per_image.softmax(dim=1).detach().numpy() # we can take the softmax to get the label probabilities @@ -243,10 +243,10 @@ save it on disk for the next usage with ``ov.save_model``. .. code:: ipython3 import openvino as ov - + fp16_model_path = Path("clip-vit-base-patch16.xml") model.config.torchscript = True - + if not fp16_model_path.exists(): ov_model = ov.convert_model(model, example_input=dict(inputs)) ov.save_model(ov_model, fp16_model_path) @@ -263,7 +263,7 @@ same input data from the example above with PyTorch. .. code:: ipython3 from scipy.special import softmax - + # create OpenVINO core object instance core = ov.Core() @@ -277,14 +277,14 @@ select device from dropdown list for running inference using OpenVINO .. code:: ipython3 import ipywidgets as widgets - + device = widgets.Dropdown( options=core.available_devices + ["AUTO"], value="AUTO", description="Device:", disabled=False, ) - + device @@ -317,8 +317,6 @@ Great! Looks like we got the same result. Quantize model to INT8 using NNCF --------------------------------- - ## Quantize model to INT8 using -NNCF The goal of this part of tutorial is to demonstrate how to speed up the model by applying 8-bit post-training quantization from @@ -349,7 +347,7 @@ inference faster. The optimization process contains the following steps: description="Quantization", disabled=False, ) - + to_quantize @@ -368,7 +366,7 @@ inference faster. The optimization process contains the following steps: url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/skip_kernel_extension.py", ) open("skip_kernel_extension.py", "w").write(r.text) - + %load_ext skip_kernel_extension Prepare datasets @@ -384,16 +382,16 @@ model. .. code:: ipython3 %%skip not $to_quantize.value - + import requests from io import BytesIO import numpy as np from PIL import Image from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) - + max_length = model.config.text_config.max_position_embeddings - + def check_text_data(data): """ Check if the given data is text-based. @@ -403,7 +401,7 @@ model. if isinstance(data, list): return all(isinstance(x, str) for x in data) return False - + def get_pil_from_url(url): """ Downloads and converts an image from a URL to a PIL Image object. @@ -411,7 +409,7 @@ model. response = requests.get(url, verify=False, timeout=20) image = Image.open(BytesIO(response.content)) return image.convert("RGB") - + def collate_fn(example, image_column="image_url", text_column="caption"): """ Preprocesses an example by loading and transforming image and text data. @@ -422,10 +420,10 @@ model. """ assert len(example) == 1 example = example[0] - + if not check_text_data(example[text_column]): raise ValueError("Text data is not valid") - + url = example[image_column] try: image = get_pil_from_url(url) @@ -434,7 +432,7 @@ model. return None except Exception: return None - + inputs = processor(text=example[text_column], images=[image], return_tensors="pt", padding=True) if inputs['input_ids'].shape[1] > max_length: return None @@ -443,11 +441,11 @@ model. .. code:: ipython3 %%skip not $to_quantize.value - + import torch from datasets import load_dataset from tqdm.notebook import tqdm - + def prepare_calibration_data(dataloader, init_steps): """ This function prepares calibration data from a dataloader for a specified number of initialization steps. @@ -470,8 +468,8 @@ model. } ) return data - - + + def prepare_dataset(opt_init_steps=50, max_train_samples=1000): """ Prepares a vision-text dataset for quantization. @@ -485,14 +483,14 @@ model. .. code:: ipython3 %%skip not $to_quantize.value - + import logging import nncf - + core = ov.Core() - + nncf.set_log_level(logging.ERROR) - + int8_model_path = 'clip-vit-base-patch16_int8.xml' calibration_data = prepare_dataset() ov_model = core.read_model(fp16_model_path) @@ -535,12 +533,12 @@ Create a quantized model from the pre-trained ``FP16`` model. .. code:: ipython3 %%skip not $to_quantize.value - + if len(calibration_data) == 0: raise RuntimeError( 'Calibration dataset is empty. Please check internet connection and try to download images manually.' ) - + calibration_dataset = nncf.Dataset(calibration_data) quantized_model = nncf.quantize( model=ov_model, @@ -654,7 +652,7 @@ the same input data that we used before. .. code:: ipython3 %%skip not $to_quantize.value - + # compile model for loading on device compiled_model = core.compile_model(quantized_model, device.value) # run inference on preprocessed data and get image-text similarity score @@ -679,9 +677,9 @@ Compare File Size .. code:: ipython3 %%skip not $to_quantize.value - + from pathlib import Path - + fp16_ir_model_size = Path(fp16_model_path).with_suffix(".bin").stat().st_size / 1024 / 1024 quantized_model_size = Path(int8_model_path).with_suffix(".bin").stat().st_size / 1024 / 1024 print(f"FP16 IR model size: {fp16_ir_model_size:.2f} MB") @@ -711,9 +709,9 @@ up of the dynamic quantized models. .. code:: ipython3 %%skip not $to_quantize.value - + import time - + def calculate_inference_time(model_path, calibration_data): model = core.compile_model(model_path, device.value) inference_time = [] @@ -728,7 +726,7 @@ up of the dynamic quantized models. .. code:: ipython3 %%skip not $to_quantize.value - + fp16_latency = calculate_inference_time(fp16_model_path, calibration_data) int8_latency = calculate_inference_time(int8_model_path, calibration_data) print(f"Performance speed up: {fp16_latency / int8_latency:.3f}") @@ -742,8 +740,6 @@ up of the dynamic quantized models. Interactive demo ---------------- - ## Interactive demo - Now, it is your turn! You can provide your own image and comma-separated list of labels for zero-shot classification. @@ -754,13 +750,13 @@ example, ``cat,dog,bird``) .. code:: ipython3 import gradio as gr - + model_path = Path("clip-vit-base-patch16-int8.xml") if not model_path.exists(): model_path = Path("clip-vit-base-patch16.xml") compiled_model = core.compile_model(model_path, device.value) - - + + def classify(image, text): """Classify image using classes listing. Args: @@ -774,10 +770,10 @@ example, ``cat,dog,bird``) inputs = processor(text=text_descriptions, images=[image], return_tensors="np", padding=True) ov_logits_per_image = compiled_model(dict(inputs))[0] probs = softmax(ov_logits_per_image, axis=1)[0] - + return {label: float(prob) for label, prob in zip(labels, probs)} - - + + demo = gr.Interface( classify, [ diff --git a/docs/notebooks/convert-to-openvino-with-output.rst b/docs/notebooks/convert-to-openvino-with-output.rst index 60b730e4f49..c3a12ea70bd 100644 --- a/docs/notebooks/convert-to-openvino-with-output.rst +++ b/docs/notebooks/convert-to-openvino-with-output.rst @@ -35,7 +35,7 @@ Table of contents: .. parsed-literal:: - Requirement already satisfied: pip in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (24.0) + Requirement already satisfied: pip in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (24.0) Note: you may need to restart the kernel to use updated packages. Note: you may need to restart the kernel to use updated packages. @@ -181,13 +181,11 @@ NLP model from Hugging Face and export it in ONNX format: .. parsed-literal:: - 2024-05-15 23:49:16.064636: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. - 2024-05-15 23:49:16.099980: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. + 2024-06-05 23:48:38.001731: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. + 2024-06-05 23:48:38.036985: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. - 2024-05-15 23:49:16.617080: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`. - warnings.warn( - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py:234: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect. + 2024-06-05 23:48:38.551703: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py:231: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect. mask, torch.tensor(torch.finfo(scores.dtype).min) @@ -664,12 +662,12 @@ frameworks conversion guides. .. parsed-literal:: - 2024-05-15 23:49:36.583572: E tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:266] failed call to cuInit: CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE: forward compatibility was attempted on non supported HW - 2024-05-15 23:49:36.583606: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:168] retrieving CUDA diagnostic information for host: iotg-dev-workstation-07 - 2024-05-15 23:49:36.583610: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:175] hostname: iotg-dev-workstation-07 - 2024-05-15 23:49:36.583842: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:199] libcuda reported version is: 470.223.2 - 2024-05-15 23:49:36.583866: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:203] kernel reported version is: 470.182.3 - 2024-05-15 23:49:36.583871: E tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:312] kernel version 470.182.3 does not match DSO version 470.223.2 -- cannot find working devices in this configuration + 2024-06-05 23:48:58.596260: E tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:266] failed call to cuInit: CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE: forward compatibility was attempted on non supported HW + 2024-06-05 23:48:58.596295: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:168] retrieving CUDA diagnostic information for host: iotg-dev-workstation-07 + 2024-06-05 23:48:58.596299: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:175] hostname: iotg-dev-workstation-07 + 2024-06-05 23:48:58.596508: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:199] libcuda reported version is: 470.223.2 + 2024-06-05 23:48:58.596524: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:203] kernel reported version is: 470.182.3 + 2024-06-05 23:48:58.596528: E tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:312] kernel version 470.182.3 does not match DSO version 470.223.2 -- cannot find working devices in this configuration Migration from Legacy conversion API diff --git a/docs/notebooks/convnext-classification-with-output.rst b/docs/notebooks/convnext-classification-with-output.rst index 692982069bd..6e7c73162fa 100644 --- a/docs/notebooks/convnext-classification-with-output.rst +++ b/docs/notebooks/convnext-classification-with-output.rst @@ -183,7 +183,7 @@ And print results Predicted Class: 281 Predicted Label: n02123045 tabby, tabby cat - Predicted Probability: 0.4661690592765808 + Predicted Probability: 0.5808374285697937 Convert the model to OpenVINO Intermediate representation format diff --git a/docs/notebooks/cross-lingual-books-alignment-with-output.rst b/docs/notebooks/cross-lingual-books-alignment-with-output.rst index fb79d3ab196..f80b3eb809c 100644 --- a/docs/notebooks/cross-lingual-books-alignment-with-output.rst +++ b/docs/notebooks/cross-lingual-books-alignment-with-output.rst @@ -197,7 +197,7 @@ which in a raw format looks like this: .. parsed-literal:: - '\ufeffThe Project Gutenberg eBook of Anna Karenina\r\n \r\nThis ebook is for the use of anyone anywhere in the United States and\r\nmost other parts of the world at no cost and with almost no restrictions\r\nwhatsoever. You may copy it, give it away or re-use it under the terms\r\nof the Project Gutenberg License included with this ebook or online\r\nat www.gutenberg.org. If you are not located in the United States,\r\nyou will have to check the laws of the country where you are located\r\nbefore using this eBook.\r\n\r\nTitle: Anna Karenina\r\n\r\n\r\nAuthor: graf Leo Tolstoy\r\n\r\nTranslator: Constance Garnett\r\n\r\nRelease date: July 1, 1998 [eBook #1399]\r\n Most recently updated: April 9, 2023\r\n\r\nLanguage: English\r\n\r\n\r\n\r\n*** START OF THE PROJECT GUTENBERG EBOOK ANNA KARENINA \*\*\*\r\n[Illustration]\r\n\r\n\r\n\r\n\r\n ANNA KARENINA \r\n\r\n by Leo Tolstoy \r\n\r\n Translated by Constance Garnett \r\n\r\nContents\r\n\r\n\r\n PART ONE\r\n PART TWO\r\n PART THREE\r\n PART FOUR\r\n PART FIVE\r\n PART SIX\r\n PART SEVEN\r\n PART EIGHT\r\n\r\n\r\n\r\n\r\nPART ONE\r\n\r\nChapter 1\r\n\r\n\r\nHappy families are all alike; every unhappy family is unhappy in its\r\nown way.\r\n\r\nEverything was in confusion in the Oblonskys’ house. The wife had\r\ndiscovered that the husband was carrying on an intrigue with a French\r\ngirl, who had been a governess in their family, and she had announced\r\nto her husband that she could not go on living in the same house with\r\nhim. This position of affairs had now lasted three days, and not only\r\nthe husband and wife themselves, but all the me' + '\ufeffThe Project Gutenberg eBook of Anna Karenina\r\n \r\nThis ebook is for the use of anyone anywhere in the United States and\r\nmost other parts of the world at no cost and with almost no restrictions\r\nwhatsoever. You may copy it, give it away or re-use it under the terms\r\nof the Project Gutenberg License included with this ebook or online\r\nat www.gutenberg.org. If you are not located in the United States,\r\nyou will have to check the laws of the country where you are located\r\nbefore using this eBook.\r\n\r\nTitle: Anna Karenina\r\n\r\n\r\nAuthor: graf Leo Tolstoy\r\n\r\nTranslator: Constance Garnett\r\n\r\nRelease date: July 1, 1998 [eBook #1399]\r\n Most recently updated: April 9, 2023\r\n\r\nLanguage: English\r\n\r\n\r\n\r\n\*\*\* START OF THE PROJECT GUTENBERG EBOOK ANNA KARENINA \*\*\*\r\n[Illustration]\r\n\r\n\r\n\r\n\r\n ANNA KARENINA \r\n\r\n by Leo Tolstoy \r\n\r\n Translated by Constance Garnett \r\n\r\nContents\r\n\r\n\r\n PART ONE\r\n PART TWO\r\n PART THREE\r\n PART FOUR\r\n PART FIVE\r\n PART SIX\r\n PART SEVEN\r\n PART EIGHT\r\n\r\n\r\n\r\n\r\nPART ONE\r\n\r\nChapter 1\r\n\r\n\r\nHappy families are all alike; every unhappy family is unhappy in its\r\nown way.\r\n\r\nEverything was in confusion in the Oblonskys’ house. The wife had\r\ndiscovered that the husband was carrying on an intrigue with a French\r\ngirl, who had been a governess in their family, and she had announced\r\nto her husband that she could not go on living in the same house with\r\nhim. This position of affairs had now lasted three days, and not only\r\nthe husband and wife themselves, but all the me' @@ -210,7 +210,7 @@ which in a raw format looks like this: .. parsed-literal:: - 'The Project Gutenberg EBook of Anna Karenina, 1. Band, by Leo N. Tolstoi\r\n\r\nThis eBook is for the use of anyone anywhere at no cost and with\r\nalmost no restrictions whatsoever. You may copy it, give it away or\r\nre-use it under the terms of the Project Gutenberg License included\r\nwith this eBook or online at www.gutenberg.org\r\n\r\n\r\nTitle: Anna Karenina, 1. Band\r\n\r\nAuthor: Leo N. Tolstoi\r\n\r\nRelease Date: February 18, 2014 [EBook #44956]\r\n\r\nLanguage: German\r\n\r\nCharacter set encoding: ISO-8859-1\r\n\r\n\*\*\* START OF THIS PROJECT GUTENBERG EBOOK ANNA KARENINA, 1. BAND \*\*\*\r\n\r\n\r\n\r\n\r\nProduced by Norbert H. Langkau, Jens Nordmann and the\r\nOnline Distributed Proofreading Team at http://www.pgdp.net\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n Anna Karenina.\r\n\r\n\r\n Roman aus dem Russischen\r\n\r\n des\r\n\r\n Grafen Leo N. Tolstoi.\r\n\r\n\r\n\r\n Nach der siebenten Auflage übersetzt\r\n\r\n von\r\n\r\n Hans Moser.\r\n\r\n\r\n Erster Band.\r\n\r\n\r\n\r\n Leipzig\r\n\r\n Druck und Verlag von Philipp Reclam jun.\r\n\r\n \* \* \* \* *\r\n\r\n\r\n\r\n\r\n Erster Teil.\r\n\r\n »Die Rache ist mein, ich will vergelten.«\r\n\r\n 1.\r\n\r\n\r\nAlle glücklichen Familien sind einander ähnlich; jede unglücklich' + 'The Project Gutenberg EBook of Anna Karenina, 1. Band, by Leo N. Tolstoi\r\n\r\nThis eBook is for the use of anyone anywhere at no cost and with\r\nalmost no restrictions whatsoever. You may copy it, give it away or\r\nre-use it under the terms of the Project Gutenberg License included\r\nwith this eBook or online at www.gutenberg.org\r\n\r\n\r\nTitle: Anna Karenina, 1. Band\r\n\r\nAuthor: Leo N. Tolstoi\r\n\r\nRelease Date: February 18, 2014 [EBook #44956]\r\n\r\nLanguage: German\r\n\r\nCharacter set encoding: ISO-8859-1\r\n\r\n\*\*\* START OF THIS PROJECT GUTENBERG EBOOK ANNA KARENINA, 1. BAND \*\*\*\r\n\r\n\r\n\r\n\r\nProduced by Norbert H. Langkau, Jens Nordmann and the\r\nOnline Distributed Proofreading Team at http://www.pgdp.net\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n Anna Karenina.\r\n\r\n\r\n Roman aus dem Russischen\r\n\r\n des\r\n\r\n Grafen Leo N. Tolstoi.\r\n\r\n\r\n\r\n Nach der siebenten Auflage übersetzt\r\n\r\n von\r\n\r\n Hans Moser.\r\n\r\n\r\n Erster Band.\r\n\r\n\r\n\r\n Leipzig\r\n\r\n Druck und Verlag von Philipp Reclam jun.\r\n\r\n * * * * *\r\n\r\n\r\n\r\n\r\n Erster Teil.\r\n\r\n »Die Rache ist mein, ich will vergelten.«\r\n\r\n 1.\r\n\r\n\r\nAlle glücklichen Familien sind einander ähnlich; jede unglücklich' @@ -407,12 +407,12 @@ languages. It has the same architecture as the BERT model but has been trained on a different task: to produce identical embeddings for translation pairs. -|image1| +|image01| This makes LaBSE a great choice for our task and it can be reused for different language pairs still producing good results. -.. |image1| image:: https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/627d3a39-7076-479f-a7b1-392f49a0b83e +.. |image01| image:: https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/627d3a39-7076-479f-a7b1-392f49a0b83e .. code:: ipython3 diff --git a/docs/notebooks/ct-segmentation-quantize-nncf-with-output.rst b/docs/notebooks/ct-segmentation-quantize-nncf-with-output.rst index c2991dc95a3..602a5753f5c 100644 --- a/docs/notebooks/ct-segmentation-quantize-nncf-with-output.rst +++ b/docs/notebooks/ct-segmentation-quantize-nncf-with-output.rst @@ -152,10 +152,10 @@ Imports .. parsed-literal:: - 2024-05-15 23:50:56.536543: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. - 2024-05-15 23:50:56.573924: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. + 2024-06-05 23:50:19.239580: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. + 2024-06-05 23:50:19.274774: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. - 2024-05-15 23:50:57.174238: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT + 2024-06-05 23:50:19.860831: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT .. parsed-literal:: @@ -435,7 +435,7 @@ this notebook. .. parsed-literal:: [ WARNING ] Please fix your imports. Module %s has been moved to %s. The old module will be deleted in version %s. - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/monai/networks/nets/basic_unet.py:168: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/monai/networks/nets/basic_unet.py:168: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if x_e.shape[-i - 1] != x_0.shape[-i - 1]: @@ -534,18 +534,18 @@ Convert quantized model to OpenVINO IR model and save it. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/torch/quantization/layers.py:337: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/torch/quantization/layers.py:337: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! return self._level_low.item() - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/torch/quantization/layers.py:345: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/nncf/torch/quantization/layers.py:345: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! return self._level_high.item() - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/monai/networks/nets/basic_unet.py:168: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/monai/networks/nets/basic_unet.py:168: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if x_e.shape[-i - 1] != x_0.shape[-i - 1]: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torch/jit/_trace.py:1116: TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the Python function. Detailed error: + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/torch/jit/_trace.py:1116: TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the Python function. Detailed error: Tensor-likes are not close! - Mismatched elements: 247888 / 262144 (94.6%) - Greatest absolute difference: 6.055658936500549 at index (0, 0, 158, 273) (up to 1e-05 allowed) - Greatest relative difference: 13834.454856259192 at index (0, 0, 343, 273) (up to 1e-05 allowed) + Mismatched elements: 249914 / 262144 (95.3%) + Greatest absolute difference: 4.319500803947449 at index (0, 0, 125, 295) (up to 1e-05 allowed) + Greatest relative difference: 10952.699411314505 at index (0, 0, 220, 387) (up to 1e-05 allowed) _check_trace( @@ -679,7 +679,7 @@ be run in the notebook with ``! benchmark_app`` or [ WARNING ] Performance hint was not explicitly specified in command line. Device(AUTO) performance hint will be set to PerformanceMode.LATENCY. [Step 4/11] Reading model files [ INFO ] Loading model files - [ INFO ] Read model took 8.68 ms + [ INFO ] Read model took 8.75 ms [ INFO ] Original model I/O parameters: [ INFO ] Model inputs: [ INFO ] x (node: x) : f32 / [...] / [?,?,?,?] @@ -693,7 +693,7 @@ be run in the notebook with ``! benchmark_app`` or [ INFO ] Model outputs: [ INFO ] ***NO_NAME*** (node: __module.final_conv/aten::_convolution/Add) : f32 / [...] / [?,1,16..,16..] [Step 7/11] Loading the model to the device - [ INFO ] Compile model took 149.48 ms + [ INFO ] Compile model took 150.71 ms [Step 8/11] Querying optimal runtime parameters [ INFO ] Model: [ INFO ] NETWORK_NAME: Model0 @@ -728,9 +728,9 @@ be run in the notebook with ``! benchmark_app`` or [Step 9/11] Creating infer requests and preparing input tensors [ ERROR ] Input x is dynamic. Provide data shapes! Traceback (most recent call last): - File "/opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/openvino/tools/benchmark/main.py", line 486, in main + File "/opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/openvino/tools/benchmark/main.py", line 486, in main data_queue = get_input_data(paths_to_input, app_inputs_info) - File "/opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/openvino/tools/benchmark/utils/inputs_filling.py", line 123, in get_input_data + File "/opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages/openvino/tools/benchmark/utils/inputs_filling.py", line 123, in get_input_data raise Exception(f"Input {info.name} is dynamic. Provide data shapes!") Exception: Input x is dynamic. Provide data shapes! @@ -758,7 +758,7 @@ be run in the notebook with ``! benchmark_app`` or [ WARNING ] Performance hint was not explicitly specified in command line. Device(AUTO) performance hint will be set to PerformanceMode.LATENCY. [Step 4/11] Reading model files [ INFO ] Loading model files - [ INFO ] Read model took 10.82 ms + [ INFO ] Read model took 10.69 ms [ INFO ] Original model I/O parameters: [ INFO ] Model inputs: [ INFO ] x (node: x) : f32 / [...] / [1,1,512,512] @@ -772,7 +772,7 @@ be run in the notebook with ``! benchmark_app`` or [ INFO ] Model outputs: [ INFO ] ***NO_NAME*** (node: __module.final_conv/aten::_convolution/Add) : f32 / [...] / [1,1,512,512] [Step 7/11] Loading the model to the device - [ INFO ] Compile model took 257.40 ms + [ INFO ] Compile model took 275.30 ms [Step 8/11] Querying optimal runtime parameters [ INFO ] Model: [ INFO ] NETWORK_NAME: Model49 @@ -809,17 +809,17 @@ be run in the notebook with ``! benchmark_app`` or [ INFO ] Fill input 'x' with random values [Step 10/11] Measuring performance (Start inference synchronously, limits: 15000 ms duration) [ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop). - [ INFO ] First inference took 27.38 ms + [ INFO ] First inference took 29.48 ms [Step 11/11] Dumping statistics report [ INFO ] Execution Devices:['CPU'] - [ INFO ] Count: 959 iterations - [ INFO ] Duration: 15011.96 ms + [ INFO ] Count: 969 iterations + [ INFO ] Duration: 15001.31 ms [ INFO ] Latency: - [ INFO ] Median: 15.40 ms - [ INFO ] Average: 15.45 ms - [ INFO ] Min: 15.18 ms - [ INFO ] Max: 17.18 ms - [ INFO ] Throughput: 63.88 FPS + [ INFO ] Median: 15.23 ms + [ INFO ] Average: 15.28 ms + [ INFO ] Min: 14.97 ms + [ INFO ] Max: 17.10 ms + [ INFO ] Throughput: 64.59 FPS Visually Compare Inference Results @@ -904,7 +904,7 @@ seed is displayed to enable reproducing specific runs of this cell. .. parsed-literal:: - Visualizing results with seed 1715809926 + Visualizing results with seed 1717624288 @@ -987,8 +987,8 @@ performs inference, and displays the results on the frames loaded in .. parsed-literal:: - Loaded model to AUTO in 0.21 seconds. - Total time for 68 frames: 2.72 seconds, fps:25.33 + Loaded model to AUTO in 0.23 seconds. + Total time for 68 frames: 2.33 seconds, fps:29.56 References diff --git a/docs/notebooks/ct-segmentation-quantize-nncf-with-output_files/ct-segmentation-quantize-nncf-with-output_37_1.png b/docs/notebooks/ct-segmentation-quantize-nncf-with-output_files/ct-segmentation-quantize-nncf-with-output_37_1.png index b3af95598c6..60f97677de5 100644 --- a/docs/notebooks/ct-segmentation-quantize-nncf-with-output_files/ct-segmentation-quantize-nncf-with-output_37_1.png +++ b/docs/notebooks/ct-segmentation-quantize-nncf-with-output_files/ct-segmentation-quantize-nncf-with-output_37_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28010020834c2072a301b1a4eab4743fe594249fd6868e415af89e0dbc74892e -size 383860 +oid sha256:1a4a6ad8cf666b4ce12cb07fa53b22a2ba0257697d926d9846ee4c18752fc553 +size 380300 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output.rst b/docs/notebooks/ddcolor-image-colorization-with-output.rst new file mode 100644 index 00000000000..24f1c30e773 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output.rst @@ -0,0 +1,778 @@ +Colorize grayscale images using DDColor and OpenVINO +====================================================== + +Image colorization is the process of adding color to grayscale images. +Initially captured in black and white, these images are transformed into +vibrant, lifelike representations by estimating RGB colors. This +technology enhances both aesthetic appeal and perceptual quality. +Historically, artists manually applied colors to monochromatic +photographs, a painstaking task that could take up to a month for a +single image. However, with advancements in information technology and +the rise of deep neural networks, automated image colorization has +become increasingly important. + +DDColor is one of the most progressive methods of image colorization in +our days. It is a novel approach using dual decoders: a pixel decoder +and a query-based color decoder, that stands out in its ability to +produce photo-realistic colorization, particularly in complex scenes +with multiple objects and diverse contexts. |image0| + +More details about this approach can be found in original model +`repository `__ and +`paper `__. + +In this tutorial we consider how to convert and run DDColor using +OpenVINO. Additionally, we will demonstrate how to optimize this model +using `NNCF `__. + +🪄 Let’s start to explore magic of image colorization! + +Table of contents: +^^^^^^^^^^^^^^^^^^ + +- `Prerequisites <#prerequisites>`__ +- `Load PyTorch model <#load-pytorch-model>`__ +- `Run PyTorch model inference <#run-pytorch-model-inference>`__ +- `Convert PyTorch model to OpenVINO Intermediate + Representation <#convert-pytorch-model-to-openvino-intermediate-representation>`__ +- `Run OpenVINO model inference <#run-openvino-model-inference>`__ +- `Optimize OpenVINO model using + NNCF <#optimize-openvino-model-using-nncf>`__ + + - `Collect quantization dataset <#collect-quantization-dataset>`__ + - `Perform model quantization <#perform-model-quantization>`__ + +- `Run INT8 model inference <#run-int8-model-inference>`__ +- `Compare FP16 and INT8 model + size <#compare-fp16-and-int8-model-size>`__ +- `Compare inference time of the FP16 and INT8 + models <#compare-inference-time-of-the-fp16-and-int8-models>`__ +- `Interactive inference <#interactive-inference>`__ + +.. |image0| image:: https://github.com/piddnad/DDColor/raw/master/assets/network_arch.jpg + +Prerequisites +------------- + + + +.. code:: ipython3 + + import platform + import os + + os.environ["GIT_CLONE_PROTECTION_ACTIVE"] = "false" + + %pip install -q timm "torch>=2.1" "torchvision" "opencv_python" "pillow" "PyYAML" "scipy" "scikit-image" "datasets" "gradio>=4.19" --extra-index-url https://download.pytorch.org/whl/cpu + %pip install -Uq --pre "openvino" --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly + %pip install -q "git+https://github.com/openvinotoolkit/nncf.git" + + if platform.python_version_tuple()[1] in ["8", "9"]: + %pip install -q "gradio-imageslider<=0.0.17" "typing-extensions>=4.9.0" + else: + %pip install -q "gradio-imageslider" + + +.. parsed-literal:: + + Note: you may need to restart the kernel to use updated packages. + ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. + openvino-dev 2024.1.0 requires openvino==2024.1.0, but you have openvino 2024.3.0.dev20240605 which is incompatible. + Note: you may need to restart the kernel to use updated packages. + Note: you may need to restart the kernel to use updated packages. + Note: you may need to restart the kernel to use updated packages. + + +.. code:: ipython3 + + import sys + from pathlib import Path + + repo_dir = Path("DDColor") + + if not repo_dir.exists(): + !git clone https://github.com/piddnad/DDColor.git + + sys.path.append(str(repo_dir)) + + +.. parsed-literal:: + + Cloning into 'DDColor'... + remote: Enumerating objects: 223, done. + remote: Counting objects: 100% (69/69), done. + remote: Compressing objects: 100% (35/35), done. + remote: Total 223 (delta 51), reused 36 (delta 33), pack-reused 154 + Receiving objects: 100% (223/223), 13.34 MiB | 22.50 MiB/s, done. + Resolving deltas: 100% (72/72), done. + + +.. code:: ipython3 + + try: + from inference.colorization_pipeline_hf import DDColorHF, ImageColorizationPipelineHF + except Exception: + from inference.colorization_pipeline_hf import DDColorHF, ImageColorizationPipelineHF + +Load PyTorch model +------------------ + + + +There are several models from DDColor’s family provided in `model +repository `__. +We will use DDColor-T, the most lightweight version of ddcolor model, +but demonstrated in the tutorial steps are also applicable to other +models from DDColor family. + +.. code:: ipython3 + + import torch + + model_name = "ddcolor_paper_tiny" + + ddcolor_model = DDColorHF.from_pretrained(f"piddnad/{model_name}") + + + colorizer = ImageColorizationPipelineHF(model=ddcolor_model, input_size=512) + + ddcolor_model.to("cpu") + colorizer.device = torch.device("cpu") + + + +.. parsed-literal:: + + config.json: 0%| | 0.00/258 [00:00 lab -> get grey -> rgb + img = cv2.resize(img, (512, 512)) + img_l = cv2.cvtColor(img, cv2.COLOR_BGR2Lab)[:, :, :1] + img_gray_lab = np.concatenate((img_l, np.zeros_like(img_l), np.zeros_like(img_l)), axis=-1) + img_gray_rgb = cv2.cvtColor(img_gray_lab, cv2.COLOR_LAB2RGB) + + # Transpose HWC -> CHW and add batch dimension + tensor_gray_rgb = torch.from_numpy(img_gray_rgb.transpose((2, 0, 1))).float().unsqueeze(0) + + # Run model inference + output_ab = compiled_model(tensor_gray_rgb)[0] + + # Postprocess result + # resize ab -> concat original l -> rgb + output_ab_resize = F.interpolate(torch.from_numpy(output_ab), size=(height, width))[0].float().numpy().transpose(1, 2, 0) + output_lab = np.concatenate((orig_l, output_ab_resize), axis=-1) + output_bgr = cv2.cvtColor(output_lab, cv2.COLOR_LAB2BGR) + + output_img = (output_bgr * 255.0).round().astype(np.uint8) + + return output_img + +.. code:: ipython3 + + ov_processed_img = process(img, compiled_model) + PIL.Image.fromarray(ov_processed_img[:, :, ::-1]) + + + + +.. image:: ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.png + + + +Optimize OpenVINO model using NNCF +---------------------------------- + + + +`NNCF `__ enables +post-training quantization by adding quantization layers into model +graph and then using a subset of the training dataset to initialize the +parameters of these additional quantization layers. Quantized operations +are executed in ``INT8`` instead of ``FP32``/``FP16`` making model +inference faster. + +The optimization process contains the following steps: + +1. Create a calibration dataset for quantization. +2. Run ``nncf.quantize()`` to obtain quantized model. +3. Save the ``INT8`` model using ``openvino.save_model()`` function. + +Please select below whether you would like to run quantization to +improve model inference speed. + +.. code:: ipython3 + + to_quantize = widgets.Checkbox( + value=True, + description="Quantization", + disabled=False, + ) + + to_quantize + + + + +.. parsed-literal:: + + Checkbox(value=True, description='Quantization') + + + +.. code:: ipython3 + + import requests + + OV_INT8_COLORIZER_PATH = Path("ddcolor_int8.xml") + compiled_int8_model = None + + r = requests.get( + url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/skip_kernel_extension.py", + ) + open("skip_kernel_extension.py", "w").write(r.text) + + %load_ext skip_kernel_extension + +Collect quantization dataset +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + +We use a portion of +`ummagumm-a/colorization_dataset `__ +dataset from Hugging Face as calibration data. + +.. code:: ipython3 + + %%skip not $to_quantize.value + + from datasets import load_dataset + + subset_size = 300 + calibration_data = [] + + if not OV_INT8_COLORIZER_PATH.exists(): + dataset = load_dataset("ummagumm-a/colorization_dataset", split="train").shuffle(seed=42) + for idx, batch in enumerate(dataset): + if idx >= subset_size: + break + img = np.array(batch["conditioning_image"]) + img = (img / 255.0).astype(np.float32) + img = cv2.resize(img, (512, 512)) + img_l = cv2.cvtColor(np.stack([img, img, img], axis=2), cv2.COLOR_BGR2Lab)[:, :, :1] + img_gray_lab = np.concatenate((img_l, np.zeros_like(img_l), np.zeros_like(img_l)), axis=-1) + img_gray_rgb = cv2.cvtColor(img_gray_lab, cv2.COLOR_LAB2RGB) + + image = np.expand_dims(img_gray_rgb.transpose((2, 0, 1)).astype(np.float32), axis=0) + calibration_data.append(image) + + + +.. parsed-literal:: + + Downloading readme: 0%| | 0.00/574 [00:00 + + + + +.. raw:: html + +
+    
+ + + + +.. parsed-literal:: + + Output() + + + +.. raw:: html + +

+
+
+
+
+.. raw:: html
+
+    
+    
+ + + +Run INT8 model inference +------------------------ + + + +.. code:: ipython3 + + from IPython.display import display + + if OV_INT8_COLORIZER_PATH.exists(): + compiled_int8_model = core.compile_model(OV_INT8_COLORIZER_PATH, device.value) + img = cv2.imread("DDColor/assets/test_images/Ansel Adams _ Moore Photography.jpeg") + img_out = process(img, compiled_int8_model) + display(PIL.Image.fromarray(img_out[:, :, ::-1])) + + + +.. image:: ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.png + + +Compare FP16 and INT8 model size +-------------------------------- + + + +.. code:: ipython3 + + fp16_ir_model_size = OV_COLORIZER_PATH.with_suffix(".bin").stat().st_size / 2**20 + + print(f"FP16 model size: {fp16_ir_model_size:.2f} MB") + + if OV_INT8_COLORIZER_PATH.exists(): + quantized_model_size = OV_INT8_COLORIZER_PATH.with_suffix(".bin").stat().st_size / 2**20 + print(f"INT8 model size: {quantized_model_size:.2f} MB") + print(f"Model compression rate: {fp16_ir_model_size / quantized_model_size:.3f}") + + +.. parsed-literal:: + + FP16 model size: 104.89 MB + INT8 model size: 52.97 MB + Model compression rate: 1.980 + + +Compare inference time of the FP16 and INT8 models +-------------------------------------------------- + + + +To measure the inference performance of OpenVINO FP16 and INT8 models, +use `Benchmark +Tool `__. + + **NOTE**: For the most accurate performance estimation, it is + recommended to run ``benchmark_app`` in a terminal/command prompt + after closing other applications. + +.. code:: ipython3 + + !benchmark_app -m $OV_COLORIZER_PATH -d $device.value -api async -shape "[1,3,512,512]" -t 15 + + +.. parsed-literal:: + + [Step 1/11] Parsing and validating input arguments + [ INFO ] Parsing input parameters + [Step 2/11] Loading OpenVINO Runtime + [ INFO ] OpenVINO: + [ INFO ] Build ................................. 2024.3.0-15599-de4d00a5970 + [ INFO ] + [ INFO ] Device info: + [ INFO ] AUTO + [ INFO ] Build ................................. 2024.3.0-15599-de4d00a5970 + [ INFO ] + [ INFO ] + [Step 3/11] Setting device configuration + [ WARNING ] Performance hint was not explicitly specified in command line. Device(AUTO) performance hint will be set to PerformanceMode.THROUGHPUT. + [Step 4/11] Reading model files + [ INFO ] Loading model files + [ INFO ] Read model took 42.73 ms + [ INFO ] Original model I/O parameters: + [ INFO ] Model inputs: + [ INFO ] x (node: x) : f32 / [...] / [1,3,512,512] + [ INFO ] Model outputs: + [ INFO ] ***NO_NAME*** (node: __module.refine_net.0.0/aten::_convolution/Add) : f32 / [...] / [1,2,512,512] + [Step 5/11] Resizing model to match image sizes and given batch + [ INFO ] Model batch size: 1 + [ INFO ] Reshaping model: 'x': [1,3,512,512] + [ INFO ] Reshape model took 0.03 ms + [Step 6/11] Configuring input of the model + [ INFO ] Model inputs: + [ INFO ] x (node: x) : u8 / [N,C,H,W] / [1,3,512,512] + [ INFO ] Model outputs: + [ INFO ] ***NO_NAME*** (node: __module.refine_net.0.0/aten::_convolution/Add) : f32 / [...] / [1,2,512,512] + [Step 7/11] Loading the model to the device + [ INFO ] Compile model took 1527.31 ms + [Step 8/11] Querying optimal runtime parameters + [ INFO ] Model: + [ INFO ] NETWORK_NAME: Model0 + [ INFO ] EXECUTION_DEVICES: ['CPU'] + [ INFO ] PERFORMANCE_HINT: PerformanceMode.THROUGHPUT + [ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 6 + [ INFO ] MULTI_DEVICE_PRIORITIES: CPU + [ INFO ] CPU: + [ INFO ] AFFINITY: Affinity.CORE + [ INFO ] CPU_DENORMALS_OPTIMIZATION: False + [ INFO ] CPU_SPARSE_WEIGHTS_DECOMPRESSION_RATE: 1.0 + [ INFO ] DYNAMIC_QUANTIZATION_GROUP_SIZE: 0 + [ INFO ] ENABLE_CPU_PINNING: True + [ INFO ] ENABLE_HYPER_THREADING: True + [ INFO ] EXECUTION_DEVICES: ['CPU'] + [ INFO ] EXECUTION_MODE_HINT: ExecutionMode.PERFORMANCE + [ INFO ] INFERENCE_NUM_THREADS: 24 + [ INFO ] INFERENCE_PRECISION_HINT: + [ INFO ] KV_CACHE_PRECISION: + [ INFO ] LOG_LEVEL: Level.NO + [ INFO ] MODEL_DISTRIBUTION_POLICY: set() + [ INFO ] NETWORK_NAME: Model0 + [ INFO ] NUM_STREAMS: 6 + [ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 6 + [ INFO ] PERFORMANCE_HINT: THROUGHPUT + [ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0 + [ INFO ] PERF_COUNT: NO + [ INFO ] SCHEDULING_CORE_TYPE: SchedulingCoreType.ANY_CORE + [ INFO ] MODEL_PRIORITY: Priority.MEDIUM + [ INFO ] LOADED_FROM_CACHE: False + [ INFO ] PERF_COUNT: False + [Step 9/11] Creating infer requests and preparing input tensors + [ WARNING ] No input files were given for input 'x'!. This input will be filled with random values! + [ INFO ] Fill input 'x' with random values + [Step 10/11] Measuring performance (Start inference asynchronously, 6 inference requests, limits: 15000 ms duration) + [ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop). + [ INFO ] First inference took 548.36 ms + [Step 11/11] Dumping statistics report + [ INFO ] Execution Devices:['CPU'] + [ INFO ] Count: 72 iterations + [ INFO ] Duration: 16675.11 ms + [ INFO ] Latency: + [ INFO ] Median: 1385.45 ms + [ INFO ] Average: 1386.39 ms + [ INFO ] Min: 1326.48 ms + [ INFO ] Max: 1447.89 ms + [ INFO ] Throughput: 4.32 FPS + + +.. code:: ipython3 + + if OV_INT8_COLORIZER_PATH.exists(): + !benchmark_app -m $OV_INT8_COLORIZER_PATH -d $device.value -api async -shape "[1,3,512,512]" -t 15 + + +.. parsed-literal:: + + [Step 1/11] Parsing and validating input arguments + [ INFO ] Parsing input parameters + [Step 2/11] Loading OpenVINO Runtime + [ INFO ] OpenVINO: + [ INFO ] Build ................................. 2024.3.0-15599-de4d00a5970 + [ INFO ] + [ INFO ] Device info: + [ INFO ] AUTO + [ INFO ] Build ................................. 2024.3.0-15599-de4d00a5970 + [ INFO ] + [ INFO ] + [Step 3/11] Setting device configuration + [ WARNING ] Performance hint was not explicitly specified in command line. Device(AUTO) performance hint will be set to PerformanceMode.THROUGHPUT. + [Step 4/11] Reading model files + [ INFO ] Loading model files + [ INFO ] Read model took 67.54 ms + [ INFO ] Original model I/O parameters: + [ INFO ] Model inputs: + [ INFO ] x (node: x) : f32 / [...] / [1,3,512,512] + [ INFO ] Model outputs: + [ INFO ] ***NO_NAME*** (node: __module.refine_net.0.0/aten::_convolution/Add) : f32 / [...] / [1,2,512,512] + [Step 5/11] Resizing model to match image sizes and given batch + [ INFO ] Model batch size: 1 + [ INFO ] Reshaping model: 'x': [1,3,512,512] + [ INFO ] Reshape model took 0.03 ms + [Step 6/11] Configuring input of the model + [ INFO ] Model inputs: + [ INFO ] x (node: x) : u8 / [N,C,H,W] / [1,3,512,512] + [ INFO ] Model outputs: + [ INFO ] ***NO_NAME*** (node: __module.refine_net.0.0/aten::_convolution/Add) : f32 / [...] / [1,2,512,512] + [Step 7/11] Loading the model to the device + [ INFO ] Compile model took 2704.43 ms + [Step 8/11] Querying optimal runtime parameters + [ INFO ] Model: + [ INFO ] NETWORK_NAME: Model0 + [ INFO ] EXECUTION_DEVICES: ['CPU'] + [ INFO ] PERFORMANCE_HINT: PerformanceMode.THROUGHPUT + [ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 6 + [ INFO ] MULTI_DEVICE_PRIORITIES: CPU + [ INFO ] CPU: + [ INFO ] AFFINITY: Affinity.CORE + [ INFO ] CPU_DENORMALS_OPTIMIZATION: False + [ INFO ] CPU_SPARSE_WEIGHTS_DECOMPRESSION_RATE: 1.0 + [ INFO ] DYNAMIC_QUANTIZATION_GROUP_SIZE: 0 + [ INFO ] ENABLE_CPU_PINNING: True + [ INFO ] ENABLE_HYPER_THREADING: True + [ INFO ] EXECUTION_DEVICES: ['CPU'] + [ INFO ] EXECUTION_MODE_HINT: ExecutionMode.PERFORMANCE + [ INFO ] INFERENCE_NUM_THREADS: 24 + [ INFO ] INFERENCE_PRECISION_HINT: + [ INFO ] KV_CACHE_PRECISION: + [ INFO ] LOG_LEVEL: Level.NO + [ INFO ] MODEL_DISTRIBUTION_POLICY: set() + [ INFO ] NETWORK_NAME: Model0 + [ INFO ] NUM_STREAMS: 6 + [ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 6 + [ INFO ] PERFORMANCE_HINT: THROUGHPUT + [ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0 + [ INFO ] PERF_COUNT: NO + [ INFO ] SCHEDULING_CORE_TYPE: SchedulingCoreType.ANY_CORE + [ INFO ] MODEL_PRIORITY: Priority.MEDIUM + [ INFO ] LOADED_FROM_CACHE: False + [ INFO ] PERF_COUNT: False + [Step 9/11] Creating infer requests and preparing input tensors + [ WARNING ] No input files were given for input 'x'!. This input will be filled with random values! + [ INFO ] Fill input 'x' with random values + [Step 10/11] Measuring performance (Start inference asynchronously, 6 inference requests, limits: 15000 ms duration) + [ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop). + [ INFO ] First inference took 290.81 ms + [Step 11/11] Dumping statistics report + [ INFO ] Execution Devices:['CPU'] + [ INFO ] Count: 150 iterations + [ INFO ] Duration: 15775.52 ms + [ INFO ] Latency: + [ INFO ] Median: 627.63 ms + [ INFO ] Average: 626.88 ms + [ INFO ] Min: 535.42 ms + [ INFO ] Max: 721.71 ms + [ INFO ] Throughput: 9.51 FPS + + +Interactive inference +--------------------- + + + +.. code:: ipython3 + + import gradio as gr + from gradio_imageslider import ImageSlider + from functools import partial + + + def generate(image, use_int8=True): + image_in = cv2.imread(image) + image_out = process(image_in, compiled_model if not use_int8 else compiled_int8_model) + image_in_pil = PIL.Image.fromarray(cv2.cvtColor(image_in, cv2.COLOR_BGR2RGB)) + image_out_pil = PIL.Image.fromarray(cv2.cvtColor(image_out, cv2.COLOR_BGR2RGB)) + return (image_in_pil, image_out_pil) + + + with gr.Blocks() as demo: + with gr.Row(equal_height=False): + image = gr.Image(type="filepath") + with gr.Column(): + output_image = ImageSlider(show_label=True, type="filepath", interactive=False, label="FP16 model output") + button = gr.Button(value="Run{}".format(" FP16 model" if compiled_int8_model is not None else "")) + with gr.Column(visible=compiled_int8_model is not None): + output_image_int8 = ImageSlider(show_label=True, type="filepath", interactive=False, label="INT8 model output") + button_i8 = gr.Button(value="Run INT8 model") + button.click(fn=partial(generate, use_int8=False), inputs=[image], outputs=[output_image]) + button_i8.click(fn=partial(generate, use_int8=True), inputs=[image], outputs=[output_image_int8]) + examples = gr.Examples( + [ + "DDColor/assets/test_images/New York Riverfront December 15, 1931.jpg", + "DDColor/assets/test_images/Audrey Hepburn.jpg", + "DDColor/assets/test_images/Acrobats Balance On Top Of The Empire State Building, 1934.jpg", + ], + inputs=[image], + ) + + + if __name__ == "__main__": + try: + demo.queue().launch(debug=False) + except Exception: + demo.queue().launch(share=True, debug=False) + # if you are launching remotely, specify server_name and server_port + # demo.launch(server_name='your server name', server_port='server port in int') + # Read more in the docs: https://gradio.app/docs/ + + +.. parsed-literal:: + + Running on local URL: http://127.0.0.1:7860 + + To create a public link, set `share=True` in `launch()`. + + + + + + + diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.jpg b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.jpg new file mode 100644 index 00000000000..4941cb1f611 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e152195f834e9ac26e7df50e12c80cf13ee8d747e62dd29edf85b6fabb98cf84 +size 164898 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.png b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.png new file mode 100644 index 00000000000..df05154ccae --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_16_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5d2b934619e33836937b6f9fe32987a37ca7506ecaf7d044d8286b6212bebe5 +size 1497558 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.jpg b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.jpg new file mode 100644 index 00000000000..96f01e15434 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c70e32cab8d811d577a589a2212a382d02aa7c51f0093e8537ee86828314c592 +size 167271 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.png b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.png new file mode 100644 index 00000000000..d4f05aeb95e --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_25_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:634bf7305f368aea78f429424e11e7f00fc341a485d74823434ac1d624a6515d +size 1521926 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.jpg b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.jpg new file mode 100644 index 00000000000..8fb53b4e8d0 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:614b930200ec51d4631b7c2a3cc743e18a8f3f94c3ea47673ef1fca37028af31 +size 152058 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.png b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.png new file mode 100644 index 00000000000..d28e544903e --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_8_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c105b02bbf0b3c82c253b6b4e92d7b28518775279197cbf239ca40dd52c9e9e +size 792834 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.jpg b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.jpg new file mode 100644 index 00000000000..77e9e43ffd6 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a92ff02af12364a2b15169f96657de93c6a172e20174f7b8a857578d58405f9 +size 164917 diff --git a/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.png b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.png new file mode 100644 index 00000000000..5e84b839762 --- /dev/null +++ b/docs/notebooks/ddcolor-image-colorization-with-output_files/ddcolor-image-colorization-with-output_9_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82894174823bc19a70eb250cf7238d542f2d81127e6bd3760d210c94796f2968 +size 1497540 diff --git a/docs/notebooks/decidiffusion-image-generation-with-output.rst b/docs/notebooks/decidiffusion-image-generation-with-output.rst index 9e878c71157..e951bc6ad86 100644 --- a/docs/notebooks/decidiffusion-image-generation-with-output.rst +++ b/docs/notebooks/decidiffusion-image-generation-with-output.rst @@ -1174,12 +1174,8 @@ improve model inference speed. .. code:: ipython3 - to_quantize = widgets.Checkbox( - value=True, - description="Quantization", - disabled=False, - ) - + skip_for_device = "GPU" in device.value + to_quantize = widgets.Checkbox(value=not skip_for_device, description="Quantization", disabled=skip_for_device) to_quantize diff --git a/docs/notebooks/depth-anything-with-output.rst b/docs/notebooks/depth-anything-with-output.rst index d583ea67720..f9d03cb4fcd 100644 --- a/docs/notebooks/depth-anything-with-output.rst +++ b/docs/notebooks/depth-anything-with-output.rst @@ -79,9 +79,9 @@ Prerequisites remote: Counting objects: 100% (144/144), done. remote: Compressing objects: 100% (105/105), done. remote: Total 421 (delta 101), reused 43 (delta 39), pack-reused 277 - Receiving objects: 100% (421/421), 237.89 MiB | 27.94 MiB/s, done. + Receiving objects: 100% (421/421), 237.89 MiB | 26.31 MiB/s, done. Resolving deltas: 100% (144/144), done. - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything Note: you may need to restart the kernel to use updated packages. Note: you may need to restart the kernel to use updated packages. WARNING: typer 0.12.3 does not provide the extra 'all' @@ -273,13 +273,13 @@ loading on device using ``core.complie_model``. .. parsed-literal:: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/dinov2/layers/patch_embed.py:73: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/dinov2/layers/patch_embed.py:73: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert H % patch_H == 0, f"Input image height {H} is not a multiple of patch height {patch_H}" - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/dinov2/layers/patch_embed.py:74: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/dinov2/layers/patch_embed.py:74: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert W % patch_W == 0, f"Input image width {W} is not a multiple of patch width: {patch_W}" - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/vision_transformer.py:183: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/torchhub/facebookresearch_dinov2_main/vision_transformer.py:183: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if npatch == N and w == h: - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/depth_anything/dpt.py:133: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/depth_anything/dpt.py:133: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! out = F.interpolate(out, (int(patch_h * 14), int(patch_w * 14)), mode="bilinear", align_corners=True) @@ -571,7 +571,7 @@ Run inference on video .. parsed-literal:: - Processed 60 frames in 13.28 seconds. Total FPS (including video processing): 4.52.Inference FPS: 10.54 + Processed 60 frames in 13.62 seconds. Total FPS (including video processing): 4.41.Inference FPS: 10.01 Video saved to 'output/Coco Walking in Berkeley_depth_anything.mp4'. @@ -598,7 +598,7 @@ Run inference on video .. parsed-literal:: Showing video saved at - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/output/Coco Walking in Berkeley_depth_anything.mp4 + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/output/Coco Walking in Berkeley_depth_anything.mp4 If you cannot see the video in your browser, please click on the following link to download the video @@ -612,7 +612,7 @@ Run inference on video .. raw:: html @@ -735,10 +735,10 @@ quantization code below may take some time. .. parsed-literal:: - 2024-05-15 23:54:08.057348: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. - 2024-05-15 23:54:08.091208: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. + 2024-06-06 00:01:26.132845: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. + 2024-06-06 00:01:26.165931: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. - 2024-05-15 23:54:08.654880: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT + 2024-06-06 00:01:26.726838: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT @@ -902,10 +902,10 @@ data. .. parsed-literal:: - Processed 60 frames in 12.70 seconds. Total FPS (including video processing): 4.73.Inference FPS: 12.89 + Processed 60 frames in 12.67 seconds. Total FPS (including video processing): 4.74.Inference FPS: 12.82 Video saved to 'output/Coco Walking in Berkeley_depth_anything_int8.mp4'. Showing video saved at - /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-681/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/output/Coco Walking in Berkeley_depth_anything.mp4 + /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-697/.workspace/scm/ov-notebook/notebooks/depth-anything/Depth-Anything/output/Coco Walking in Berkeley_depth_anything.mp4 If you cannot see the video in your browser, please click on the following link to download the video @@ -919,7 +919,7 @@ data. .. raw:: html @@ -985,9 +985,9 @@ Tool =2023.1.0" diff --git a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.jpg b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.jpg index f80eeeb0a2b..009298597f3 100644 --- a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.jpg +++ b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:402297f642d1ae24c5f34c947b243308e80a2353a297ff4fbc29a80a91447f3d -size 57749 +oid sha256:eb6a3c05535408d011ad8aa46258978d309afda0fe57ab8c97ea81078386469c +size 58366 diff --git a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.png b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.png index 914c56acc0b..84292f2d1d3 100644 --- a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.png +++ b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_22_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfdce03dd80512c030e07a93860311e984178cc6c00aea85904d97a9d85fd91b -size 507627 +oid sha256:84897b3dce254b9f229b11ab01345853e5a8397bb232c2dbf9e9062f6a3d3857 +size 509075 diff --git a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.jpg b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.jpg index de3cdef72f0..42770b2466d 100644 --- a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.jpg +++ b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d467c3878c59234b1e763ec286626e3036584d037e32857396ec873b73347d3c -size 53573 +oid sha256:c558219ed9c6dae7fa76cbd8791cdb30ea5ee7d88af767ff82b989067e11ff6b +size 54727 diff --git a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.png b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.png index 2d5cc464a97..946beed11b4 100644 --- a/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.png +++ b/docs/notebooks/detectron2-to-openvino-with-output_files/detectron2-to-openvino-with-output_32_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef9d6efc8183a218693431a458cd84831e4820d02518cfd9d67f6c532ffc6f53 -size 456551 +oid sha256:a3202c1e5f4b8914b4290f1189e147f965b87d6556b8ed8d59d12ebf7812db9a +size 457983 diff --git a/docs/notebooks/distil-whisper-asr-with-output.rst b/docs/notebooks/distil-whisper-asr-with-output.rst index d1090b4abbb..1e27e7ebf6a 100644 --- a/docs/notebooks/distil-whisper-asr-with-output.rst +++ b/docs/notebooks/distil-whisper-asr-with-output.rst @@ -105,7 +105,7 @@ using tokenizer. .. code:: ipython3 import ipywidgets as widgets - + model_ids = { "Distil-Whisper": [ "distil-whisper/distil-large-v2", @@ -126,14 +126,14 @@ using tokenizer. "openai/whisper-tiny.en", ], } - + model_type = widgets.Dropdown( options=model_ids.keys(), value="Distil-Whisper", description="Model type:", disabled=False, ) - + model_type .. code:: ipython3 @@ -144,15 +144,15 @@ using tokenizer. description="Model:", disabled=False, ) - + model_id .. code:: ipython3 from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq - + processor = AutoProcessor.from_pretrained(model_id.value) - + pt_model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id.value) pt_model.eval(); @@ -175,8 +175,8 @@ by Hugging Face datasets implementation. .. code:: ipython3 from datasets import load_dataset - - + + def extract_input_features(sample): input_features = processor( sample["audio"]["array"], @@ -184,8 +184,8 @@ by Hugging Face datasets implementation. return_tensors="pt", ).input_features return input_features - - + + dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") sample = dataset[0] input_features = extract_input_features(sample) @@ -202,10 +202,10 @@ for decoding predicted token_ids into text transcription. .. code:: ipython3 import IPython.display as ipd - + predicted_ids = pt_model.generate(input_features) transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True) - + display(ipd.Audio(sample["audio"]["array"], rate=sample["audio"]["sampling_rate"])) print(f"Reference: {sample['text']}") print(f"Result: {transcription[0]}") @@ -214,7 +214,7 @@ for decoding predicted token_ids into text transcription. .. raw:: html - +