Skip to content

Commit 589d9c8

Browse files
committed
Fix metadata file path initialization
1 parent db3a6ce commit 589d9c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

onnxruntime/core/providers/openvino/backend_manager.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ BackendManager::BackendManager(SessionContext& session_context,
8888
std::string device_type = session_context_.device_type;
8989

9090
auto& sw = shared_context_.shared_weights;
91-
if (session_context_.so_share_ep_contexts) {
91+
if (session_context_.so_share_ep_contexts && !sw.metadata.empty()) {
9292
std::filesystem::path weight_filename = session_context_.onnx_model_path_name.parent_path();
93-
if (sw.external_weight_filename.empty() && !sw.metadata.empty()) {
93+
if (sw.external_weight_filename.empty()) {
9494
// Reasonable assumption that all metadata entries have the same external file location
9595
sw.external_weight_filename = sw.metadata.begin()->second.location;
9696
}

onnxruntime/core/providers/openvino/openvino_execution_provider.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ common::Status OpenVINOExecutionProvider::Compile(
189189
// For models after the first the metadata name comes from the shared context
190190
fs::path metadata_file_path = shared_context_->shared_weights.metadata_filepath;
191191
if (metadata_file_path.empty()) {
192-
session_context_.so_context_file_path;
192+
metadata_file_path = session_context_.so_context_file_path;
193193
if (metadata_file_path.empty()) {
194194
metadata_file_path = session_context_.onnx_model_path_name;
195195
}

0 commit comments

Comments
 (0)