Skip to content

Commit

Permalink
Fixed pyi file build when OpenVINO_DIR is externally defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Nov 28, 2024
1 parent 86068a5 commit 01427b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ elseif(DEFINED PY_BUILD_CMAKE_PACKAGE_NAME AND NOT WIN32)
# in case of wheel build, pybind11-stubgen is always available via pyproject.toml's build-system
# except Win32 where we have issues with pybind11_stubgen executable which cannot import its own module
set(pybind11_stubgen_AVAILABLE ON)

# by default, wheel build is performed with build-isolation, which means that some variables like PYTHONPATH
# are not available. But if user called setupvars.sh, then OpenVINO dir is available, while PYTHONPATH - no.
# In this case, we will have mismatch on Linux when OpenVINO can point on build dir / install dir, while
# PYTHONPATH points out to locally installed tmp OpenVINO wheel (build against wheel).
# We need to detect such case and disable it
if(LINUX AND NOT OpenVINO_DIR STREQUAL OpenVINO_DIR_PY)
set(pybind11_stubgen_AVAILABLE OFF)
endif()
endif()

# but we also need to check whether OpenVINO is installed
Expand Down Expand Up @@ -167,7 +176,7 @@ if(pybind11_stubgen_AVAILABLE)
add_custom_command(OUTPUT ${output_file}
COMMAND "${CMAKE_COMMAND}" -E rm -f "${CMAKE_BINARY_DIR}/openvino_genai/__init__.pyi"
"${CMAKE_BINARY_DIR}/openvino_genai/py_openvino_genai.pyi"
COMMAND "${CMAKE_COMMAND}" -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${openvino_pythonpath}:$ENV{PYTHONPATH}
COMMAND "${CMAKE_COMMAND}" -E env PYTHONPATH=${CMAKE_BINARY_DIR}:$ENV{PYTHONPATH}
${pybind11_stubgen} --output-dir ${stub_files_location} openvino_genai
${validation_command}
${copy_to_source_command}
Expand Down
2 changes: 1 addition & 1 deletion src/python/py_vlm_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ auto vlm_generate_docstring = R"(
:type images: List[ov.Tensor] or ov.Tensor
:param generation_config: generation_config
:type generation_config: GenerationConfig or a Dict
:type generation_config: GenerationConfig or a Dict
:param streamer: streamer either as a lambda with a boolean returning flag whether generation should be stopped
:type : Callable[[str], bool], ov.genai.StreamerBase
Expand Down

0 comments on commit 01427b0

Please sign in to comment.