Ovep 1.17.1 (#19482)

### Description
Handle  bugs for API backward compatability.
Update to consume the onnx model path rather the onnx serialised model
to OV compile_model API
This commit is contained in:
Preetha Veeramalai 2024-02-13 02:01:08 +05:30 committed by GitHub
parent 9cb97ee507
commit 90e2e8561f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 15 deletions

View file

@ -70,10 +70,13 @@ BasicBackend::BasicBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
LOGS_DEFAULT(INFO) << log_tag << "Loaded model to the plugin";
}
#else
if (global_context_.disable_dynamic_shapes && dev_prec != "CPU_FP16") {
const std::string model = model_proto.SerializeAsString();
exe_network_ = global_context_.ie_core.LoadNetwork(
model, hw_target, device_config, subgraph_context_.subgraph_name);
if (!subgraph_context_.has_dynamic_input_shape &&
global_context_.onnx_model_path_name != "" &&
dev_prec != "CPU_FP16") {
exe_network_ = global_context_.ie_core.LoadNetwork(global_context_.onnx_model_path_name,
hw_target,
device_config,
subgraph_context_.subgraph_name);
LOGS_DEFAULT(INFO) << log_tag << "Loaded model to the plugin";
} else {
ie_cnn_network_ = CreateOVModel(model_proto, global_context_, subgraph_context_, const_outputs_map_);

View file

@ -87,13 +87,13 @@ OVExeNetwork OVCore::LoadNetwork(std::shared_ptr<OVNetwork>& ie_cnn_network,
}
}
OVExeNetwork OVCore::LoadNetwork(const std::string& model,
OVExeNetwork OVCore::LoadNetwork(const std::string onnx_model_path,
std::string& hw_target,
ov::AnyMap& device_config,
std::string name) {
ov::CompiledModel obj;
try {
obj = oe.compile_model(model, ov::Tensor(), hw_target, device_config);
obj = oe.compile_model(onnx_model_path, hw_target, device_config);
OVExeNetwork exe(obj);
return exe;
} catch (const Exception& e) {

View file

@ -45,7 +45,7 @@ class OVCore {
std::string& hw_target,
ov::AnyMap& device_config,
std::string name);
OVExeNetwork LoadNetwork(const std::string& model_stream,
OVExeNetwork LoadNetwork(const std::string model_path,
std::string& hw_target,
ov::AnyMap& device_config,
std::string name);

View file

@ -1682,7 +1682,11 @@ ProviderOptions OrtOpenVINOProviderOptionsToOrtOpenVINOProviderOptionsV2(const O
if (legacy_ov_options->device_type != nullptr)
ov_options_converted_map["device_type"] = legacy_ov_options->device_type;
ov_options_converted_map["enable_npu_fast_compile"] = legacy_ov_options->enable_npu_fast_compile;
if (legacy_ov_options->enable_npu_fast_compile) {
ov_options_converted_map["enable_npu_fast_compile"] = "false";
} else {
ov_options_converted_map["enable_npu_fast_compile"] = "true";
}
if (legacy_ov_options->device_id != nullptr)
ov_options_converted_map["device_id"] = legacy_ov_options->device_id;
@ -1701,14 +1705,12 @@ ProviderOptions OrtOpenVINOProviderOptionsToOrtOpenVINOProviderOptionsV2(const O
ov_options_converted_map["enable_opencl_throttling"] = legacy_ov_options->enable_opencl_throttling;
if (legacy_ov_options->enable_dynamic_shapes != '\0') {
std::string enable_dynamic_shapes = reinterpret_cast<const char*>(legacy_ov_options->enable_dynamic_shapes);
if (enable_dynamic_shapes == "true" || enable_dynamic_shapes == "True") {
ov_options_converted_map["disable_dynamic_shapes"] = "false";
} else if (enable_dynamic_shapes == "false" || enable_dynamic_shapes == "False") {
ov_options_converted_map["disable_dynamic_shapes"] = "true";
}
if (legacy_ov_options->enable_dynamic_shapes) {
ov_options_converted_map["disable_dynamic_shapes"] = "false";
} else {
ov_options_converted_map["disable_dynamic_shapes"] = "true";
}
// Add new provider option below
ov_options_converted_map["num_streams"] = "1";
return ov_options_converted_map;