From 328b8a49f10cc9ca65d5772c0b520ba5846231ec Mon Sep 17 00:00:00 2001 From: Preetha Veeramalai Date: Mon, 7 Aug 2023 21:31:20 -0700 Subject: [PATCH] Add fix for python ORT2.0 --- cmake/deps.txt | 1 + docs/python/ReadMeOV.rst | 3 +++ onnxruntime/core/providers/openvino/ov_interface.h | 2 +- onnxruntime/core/session/provider_registration.cc | 3 +-- onnxruntime/python/onnxruntime_pybind_schema.cc | 5 ++++- onnxruntime/test/perftest/ort_test_session.cc | 7 ++++--- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/cmake/deps.txt b/cmake/deps.txt index 56714f6d9dfdb..4574567ad754c 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -32,6 +32,7 @@ protoc_win32;https://github.com/protocolbuffers/protobuf/releases/download/v21.1 protoc_linux_x64;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip;338462004aa5be9fba45b35b5b4be43f69b47a90 protoc_linux_x86;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_32.zip;61fdbe7d6360e065ec6fea23bca2cca673115fb8 protoc_linux_aarch64;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-aarch_64.zip;df9d45470b0b8cf939dd2f0ec6b88e9cafc4d617 +protoc_mac_universal;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip;23710c3d1c2036d8d65a6a22234372fa2d7af9ef psimd;https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip;1f5454b01f06f9656b77e4a5e2e31d7422487013 pthreadpool;https://github.com/Maratyszcza/pthreadpool/archive/1787867f6183f056420e532eec640cba25efafea.zip;e43e80781560c5ab404a4da20f34d846f5f5d101 pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.10.1.zip;769b6aa67a77f17a770960f604b727645b6f6a13 diff --git a/docs/python/ReadMeOV.rst b/docs/python/ReadMeOV.rst index aa584f7ba1e1c..544739ebb7616 100644 --- a/docs/python/ReadMeOV.rst +++ b/docs/python/ReadMeOV.rst @@ -7,6 +7,7 @@ OpenVINO™ Execution Provider for ONNX Runtime accelerates inference across man - Intel® CPUs - Intel® integrated GPUs - Intel® discrete GPUs + - Intel® integrated VPUs Installation ------------ @@ -20,6 +21,8 @@ Requirements This package supports: - Intel® CPUs - Intel® integrated GPUs + - Intel® discrete GPUs + - Intel® integrated VPUs ``pip3 install onnxruntime-openvino`` diff --git a/onnxruntime/core/providers/openvino/ov_interface.h b/onnxruntime/core/providers/openvino/ov_interface.h index 86af2de5fd1dd..ed9583033ab34 100644 --- a/onnxruntime/core/providers/openvino/ov_interface.h +++ b/onnxruntime/core/providers/openvino/ov_interface.h @@ -44,7 +44,7 @@ class OVCore { public: std::shared_ptr ReadModel(const std::string& model_stream) const; OVExeNetwork LoadNetwork(std::shared_ptr& ie_cnn_network, std::string& hw_target, ov::AnyMap& device_config, std::string name); -#if defined(OPENVINO_2023_0) +#if defined(OPENVINO_2023_0) || (OPENVINO_2023_1) OVExeNetwork LoadNetwork(const std::string& model_stream, std::string& hw_target, ov::AnyMap& device_config, std::string name); #endif void SetCache(std::string cache_dir_path); diff --git a/onnxruntime/core/session/provider_registration.cc b/onnxruntime/core/session/provider_registration.cc index 5950a24561194..8b2d03b7f8def 100644 --- a/onnxruntime/core/session/provider_registration.cc +++ b/onnxruntime/core/session/provider_registration.cc @@ -68,7 +68,6 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider, }; if (strcmp(provider_name, "QNN") == 0) { - // if (strcmp(provider_name, "QNN") == 0) { #if defined(USE_QNN) options->provider_factories.push_back(QNNProviderFactoryCreator::Create(provider_options, &(options->value))); #else @@ -123,7 +122,7 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider, } else { ORT_UNUSED_PARAMETER(options); status = OrtApis::CreateStatus(ORT_INVALID_ARGUMENT, - "Unknown provider name. Currently supported values are 'OPENVINO', 'SNPE', 'XNNPACK', and 'AZURE'"); + "Unknown provider name. Currently supported values are 'OPENVINO', 'SNPE', 'XNNPACK', 'QNN', 'WEBNN' and 'AZURE'"); } return status; diff --git a/onnxruntime/python/onnxruntime_pybind_schema.cc b/onnxruntime/python/onnxruntime_pybind_schema.cc index 5bdcb101e4bfc..bc8202837a186 100644 --- a/onnxruntime/python/onnxruntime_pybind_schema.cc +++ b/onnxruntime/python/onnxruntime_pybind_schema.cc @@ -38,7 +38,10 @@ void addGlobalSchemaFunctions(pybind11::module& m) { onnxruntime::DnnlProviderFactoryCreator::Create(1), #endif #ifdef USE_OPENVINO - onnxruntime::OpenVINOProviderFactoryCreator::Create(ProviderOptions{}, nullptr), + []() { + ProviderOptions provider_options_map; + return onnxruntime::OpenVINOProviderFactoryCreator::Create(&provider_options_map); + }(), #endif #ifdef USE_TENSORRT onnxruntime::TensorrtProviderFactoryCreator::Create(0), diff --git a/onnxruntime/test/perftest/ort_test_session.cc b/onnxruntime/test/perftest/ort_test_session.cc index 4e265d262f2d4..d4a0f2bc4c0c8 100644 --- a/onnxruntime/test/perftest/ort_test_session.cc +++ b/onnxruntime/test/perftest/ort_test_session.cc @@ -446,7 +446,8 @@ OnnxRuntimeTestSession::OnnxRuntimeTestSession(Ort::Env& env, std::random_device if (key == "device_type") { std::set ov_supported_device_types = {"CPU_FP32", "CPU_FP16", "GPU_FP32", "GPU.0_FP32", "GPU.1_FP32", "GPU_FP16", - "GPU.0_FP16", "GPU.1_FP16"}; + "GPU.0_FP16", "GPU.1_FP16", + "VPUX_FP16", "VPUX_U8"}; if (ov_supported_device_types.find(value) != ov_supported_device_types.end()) { ov_options[key] = value; } else if (value.find("HETERO:") == 0) { @@ -459,7 +460,7 @@ OnnxRuntimeTestSession::OnnxRuntimeTestSession(Ort::Env& env, std::random_device ORT_THROW( "[ERROR] [OpenVINO] You have selcted wrong configuration value for the key 'device_type'. " "Select from 'CPU_FP32', 'CPU_FP16', 'GPU_FP32', 'GPU.0_FP32', 'GPU.1_FP32', 'GPU_FP16', " - "'GPU.0_FP16', 'GPU.1_FP16' or from" + "'GPU.0_FP16', 'GPU.1_FP16', 'VPUX_FP16', 'VPUX_U8' or from" " HETERO/MULTI/AUTO options available. \n"); } } else if (key == "device_id") { @@ -561,7 +562,7 @@ OnnxRuntimeTestSession::OnnxRuntimeTestSession(Ort::Env& env, std::random_device ORT_THROW("Supported htp_performance_mode: " + str); } } else { - ORT_THROW(R"(Wrong key type entered. Choose from options: ['backend_path', 'qnn_context_cache_enable', + ORT_THROW(R"(Wrong key type entered. Choose from options: ['backend_path', 'qnn_context_cache_enable', 'qnn_context_cache_path', 'profiling_level', 'rpc_control_latency', 'htp_performance_mode'])"); }