mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-27 03:11:28 +00:00
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:
parent
9cb97ee507
commit
90e2e8561f
4 changed files with 20 additions and 15 deletions
|
|
@ -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_);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue