[PyOV] Backport of wheel building fix (#19013)

* Add upper bound

* backport flake fix

* Support of protobuf >= 21 (#18351)

* Corrected typo

* Ability to compile with newer protobuf versions

* Limit numpy (#18406)

* Revert "[PyOV] Pin version of Cython for API 1.0 (#18604)" (#18681)

* Revert "[PyOV] Pin version of Cython for API 1.0 (#18604)"

This reverts commit 787796d88f.

* Suppressed clang warning

* Restrict scipy module version for POT (#18237)

* Restrict scipy module version for POT

Latest release https://pypi.org/project/scipy/1.11.0 causes dependency conflicts

* Bump OMZ to include scipy restriction

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
Co-authored-by: Alina Kladieva <alina.kladieva@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
This commit is contained in:
Przemyslaw Wysocki 2023-08-07 16:23:05 +02:00 committed by GitHub
parent 4ddeecc031
commit 84a3aab115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 60 additions and 19 deletions

View File

@ -2,7 +2,7 @@
ade/0.1.2a
onetbb/[>=2021.2.1]
pugixml/[>=1.10]
protobuf/[>=3.20.3]
protobuf/3.21.9
ittapi/[>=3.23.0]
zlib/[>=1.2.8]
opencl-icd-loader/[>=2022.09.30]
@ -19,7 +19,7 @@ flatbuffers/[>=22.9.24]
[tool_requires]
cmake/[>=3.15]
patchelf/[>=0.12]
protobuf/[>=3.20.3]
protobuf/3.21.9
flatbuffers/[>=22.9.24]
[options]

View File

@ -3,9 +3,10 @@
# D100 - Missing docstring in public module
# D101 - Missing docstring in public class
# D103 - Missing docstring in public function
# VNE001 - Single letter variable names are not allowed
filename = *.py
max-line-length = 160
ignore = E203,D100,D101,D103
ignore = E203,D100,D101,D103,VNE001
max-parameters-amount = 8
show_source = True
docstring-convention = google

View File

@ -13,7 +13,7 @@ pytest-timeout==2.0.1
py>=1.9.0
pygments>=2.8.1
setuptools>=53.0.0
wheel>=0.38.1
wheel>=0.38.1,<=0.41.0
# Frontends
docopt~=0.6.2

View File

@ -21,9 +21,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# 'argument': conversion from 'size_t' to 'int', possible loss of data
ie_add_compiler_flags(/wd4267)
ie_add_compiler_flags(/wd4244)
ie_add_compiler_flags(/wd4551)
endif()
if (OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
if(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-undef)
if(OV_COMPILER_IS_CLANG)
ie_add_compiler_flags(-Wno-parentheses-equality)
endif()
endif()
if(UNUSED_BUT_SET_VARIABLE_SUPPORTED)
ie_add_compiler_flags(-Wno-unused-but-set-variable)

View File

@ -369,7 +369,7 @@ def test_split_1d():
def test_depth_to_space():
b, c, h, w = shape = (2, 8, 3, 3)
b, c, h, w = shape = (2, 8, 3, 3) # noqa: VNE001
blocksize = 2
data = np.random.random_sample(shape).astype(np.float32)
tmp = np.reshape(data, [b, blocksize, blocksize, c // (blocksize ** 2), h, w])

View File

@ -1,3 +1,3 @@
setuptools>=65.6.1
wheel>=0.38.1
wheel>=0.38.1,<=0.41.0
patchelf<=0.17.2.1; sys_platform == 'linux' and platform_machine == 'x86_64'

View File

@ -9,3 +9,4 @@ add_library(${TARGET_NAME} STATIC shutdown_protobuf.cpp)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
$<BUILD_INTERFACE:$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>>)
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
target_compile_features(${TARGET_NAME} PRIVATE $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_FEATURES>)

View File

@ -2,7 +2,15 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
#include <google/protobuf/port_undef.inc>
#ifndef OV_PROTOBUF_ABSL_IS_USED
# include <google/protobuf/stubs/logging.h>
#endif
#include <fstream>
#include <input_model.hpp>
@ -37,7 +45,9 @@ ONNX_FRONTEND_C_API void* get_front_end_data() {
};
#ifndef OPENVINO_DEBUG_ENABLE
// disable protobuf logging
# ifndef OV_PROTOBUF_ABSL_IS_USED
google::protobuf::SetLogHandler(nullptr);
# endif
#endif
return res;
}

View File

@ -4,7 +4,15 @@
#include "openvino/frontend/paddle/frontend.hpp"
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
#include <google/protobuf/port_undef.inc>
#ifndef OV_PROTOBUF_ABSL_IS_USED
# include <google/protobuf/stubs/logging.h>
#endif
#include <fstream>
#include <map>
@ -551,7 +559,9 @@ PADDLE_C_API void* get_front_end_data() {
#ifndef OPENVINO_DEBUG_ENABLE
// disable protobuf logging
# ifndef OV_PROTOBUF_ABSL_IS_USED
google::protobuf::SetLogHandler(nullptr);
# endif
#endif
return res;
}

View File

@ -7,7 +7,7 @@ pandas>=1.3.5
pymongo>=3.12.0
PyYAML>=5.4.1
scipy>=1.7
wheel>=0.38.1
wheel>=0.38.1,<=0.41.0
defusedxml>=0.7.1
fastjsonschema~=2.15.1
test-generator==0.1.2

View File

@ -423,7 +423,16 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND
if(CMAKE_VERBOSE_MAKEFILE)
set(Protobuf_DEBUG ON)
endif()
find_package(Protobuf 3.20.3 REQUIRED)
# Note: we also specify 'protobuf' in NAMES because of vcpkg
set(find_package_protobuf_names Protobuf protobuf)
# try to find newer version first (major is changed)
# see https://protobuf.dev/support/version-support/ and
# https://github.com/protocolbuffers/protobuf/commit/d61f75ff6db36b4f9c0765f131f8edc2f86310fa
find_package(Protobuf 4.22.0 QUIET NAMES ${find_package_protobuf_names})
if(NOT Protobuf_FOUND)
# otherwise, fallback to existing default
find_package(Protobuf 3.20.3 REQUIRED NAMES ${find_package_protobuf_names})
endif()
set(PROTOC_EXECUTABLE protobuf::protoc)
# in case of system protobuf, we have to add version to OpenVINOConfig.cmake for static build

View File

@ -49,7 +49,6 @@ endforeach()
if(WIN32)
# from onnx==1.13.1 it requires C++17 when compiling on Windows
target_compile_features(onnx PRIVATE cxx_std_17)
set_target_properties(onnx PROPERTIES CXX_STANDARD 17)
# OPTIONAL is a reserved word for mingw at least
if(MINGW)
target_compile_definitions(onnx PRIVATE OPTIONAL=OPTIONAL_PLACEHOLDER)

@ -1 +1 @@
Subproject commit 5a513cc493f4036fb7b543e952ec1a5fa72b74ee
Subproject commit c7a13a842d41333397ea6c3f9bc5a7053da00eec

View File

@ -22,6 +22,7 @@ set(protobuf_VERBOSE ON)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Abseil protogate CXX standard to dependent targets" FORCE)
# note: HOST_AARCH64 AND X86_64 are not handled for Apple explicitly, because it can work via Rosetta
if(CMAKE_CROSSCOMPILING OR
@ -38,8 +39,14 @@ if(NOT DEFINED protobuf_MSVC_STATIC_RUNTIME)
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link protobuf to static runtime libraries" FORCE)
endif()
add_subdirectory(protobuf/cmake EXCLUDE_FROM_ALL)
get_directory_property(protobuf_VERSION DIRECTORY protobuf/cmake DEFINITION protobuf_VERSION)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/protobuf/CMakeLists.txt")
set(protobuf_dir protobuf)
else()
set(protobuf_dir protobuf/cmake)
endif()
add_subdirectory(${protobuf_dir} EXCLUDE_FROM_ALL)
get_directory_property(protobuf_VERSION DIRECTORY ${protobuf_dir} DEFINITION protobuf_VERSION)
set(Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/src)
@ -61,7 +68,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
endif()
if(protobuf_VERSION VERSION_LESS "3.9")
if(protobuf_VERSION VERSION_LESS 3.9)
message(FATAL_ERROR "Minimum supported version of protobuf-lite library is 3.9.0 (provided ${protobuf_VERSION})")
endif()
@ -76,7 +83,7 @@ if(NOT protobuf_BUILD_PROTOC_BINARIES)
CMAKE_ARGS "-Dprotobuf_VERBOSE=${protobuf_VERBOSE}"
"-Dprotobuf_BUILD_TESTS=${protobuf_BUILD_TESTS}"
"-Dprotobuf_WITH_ZLIB=${protobuf_WITH_ZLIB}"
NATIVE_SOURCE_SUBDIR "protobuf/cmake"
NATIVE_SOURCE_SUBDIR "${protobuf_dir}"
NATIVE_TARGETS protoc libprotobuf-lite)
set(PROTOC_EXECUTABLE "${HOST_PROTOC_INSTALL_DIR}/bin/protoc")

View File

@ -1,5 +1,5 @@
-c ../constraints.txt
numpy>=1.16.6,<1.25.0
numpy>=1.16.6,<1.24
mxnet
networkx
defusedxml

View File

@ -67,7 +67,7 @@ if '--install-dev-extras' in sys.argv:
INSTALL_REQUIRES = [
"numpy>=1.16.6",
"scipy~=1.7; python_version == '3.7'",
"scipy>=1.8; python_version >= '3.8'",
"scipy>=1.8,<1.11; python_version >= '3.8'",
"jstyleson>=0.0.2",
"addict>=2.4.0",
"networkx<=3.1",