From 96bcffebddf724fb7c9e28f0bb6fdabf36e96814 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 14 Nov 2024 13:56:48 +0400 Subject: [PATCH] Build GenAI via OpenVINO wheel (#958) --- .github/workflows/windows.yml | 4 ++-- CMakeLists.txt | 13 ++++++++++++- pyproject.toml | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index aef0181baa..1e4164aa0b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -243,7 +243,7 @@ jobs: - name: Test bindings (wheel) run: | . "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" - python -m pip install . --verbose + python -m pip install . --verbose --find-links ${env:OV_INSTALL_DIR}/wheels python -m pytest -v ./tests/python_tests/ --ignore ./tests/python_tests/test_whisper_generate_api.py --ignore ./tests/python_tests/test_vlm_api.py -k "not test_set_chat_template" genai_python_lib_whisper: @@ -307,7 +307,7 @@ jobs: - name: Test bindings (wheel) run: | . "${{ env.OV_INSTALL_DIR }}/setupvars.ps1" - python -m pip install . --verbose + python -m pip install . --verbose --find-links ${env:OV_INSTALL_DIR}/wheels python -m pytest -v ./tests/python_tests/test_whisper_generate_api.py -k "not test_smoke" genai_python_lib_vlm: diff --git a/CMakeLists.txt b/CMakeLists.txt index d058b2ebee..e84f1213ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,13 +31,24 @@ project(OpenVINOGenAI HOMEPAGE_URL "https://github.com/openvinotoolkit/openvino.genai" LANGUAGES CXX C) +# Looking for OpenVINO in the python distribution. It doesn't work for cross-compiling build +if(NOT CMAKE_CROSSCOMPILING) + find_package(Python3 REQUIRED) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')" + OUTPUT_VARIABLE OpenVINO_DIR_PY + ERROR_QUIET + ) +endif() + # Find OpenVINODeveloperPackage first to compile with SDL flags find_package(OpenVINODeveloperPackage ${OpenVINOGenAI_VERSION} QUIET COMPONENTS Runtime PATHS "${OpenVINO_DIR}") if(NOT OpenVINODeveloperPackage_FOUND) find_package(OpenVINO ${OpenVINOGenAI_VERSION} REQUIRED - COMPONENTS Runtime) + COMPONENTS Runtime + PATHS "${OpenVINO_DIR_PY}") endif() include(cmake/features.cmake) diff --git a/pyproject.toml b/pyproject.toml index 9a42c5d6da..90c71c0ef7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,8 @@ options = {"BUILD_TOKENIZERS" = "OFF"} [build-system] requires = [ "py-build-cmake@git+https://github.com/tttapa/py-build-cmake@7ab73da351c7140f06d727a8705bece4cf544cd9", - "cmake~=3.23" + "cmake~=3.23", + "openvino~=2025.0.0.0.dev" ] build-backend = "py_build_cmake.build"