From 782ca0f8bdab276ef1db621f1e565c5c609ed459 Mon Sep 17 00:00:00 2001 From: Tomasz Krupa Date: Tue, 18 Mar 2025 08:08:28 +0000 Subject: [PATCH] Add MODEL_PTR to config only if plugin supports it --- src/inference/src/dev/core_impl.cpp | 16 ++++++++-------- src/plugins/intel_gpu/src/plugin/plugin.cpp | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index a3d3f1248bfb17..06cef1c95e8515 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -1478,16 +1478,16 @@ ov::SoPtr ov::CoreImpl::load_model_from_cache( ov::AnyMap update_config = config; update_config[ov::loaded_from_cache.name()] = true; + if (util::contains(plugin.get_property(ov::supported_properties), ov::hint::model) && + cacheContent.model) { + update_config[ov::hint::model.name()] = cacheContent.model; + } if (util::contains(plugin.get_property(ov::supported_properties), ov::weights_path)) { - if (cacheContent.model) { - update_config[ov::hint::model.name()] = cacheContent.model; - } else { - std::filesystem::path weights_path = cacheContent.modelPath; - weights_path.replace_extension(".bin"); + std::filesystem::path weights_path = cacheContent.modelPath; + weights_path.replace_extension(".bin"); - if (ov::util::file_exists(weights_path)) { - update_config[ov::weights_path.name()] = weights_path.string(); - } + if (ov::util::file_exists(weights_path)) { + update_config[ov::weights_path.name()] = weights_path.string(); } } if (model_buffer) { diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp index d14b0a45eef4e3..3f9bf4e412a2aa 100644 --- a/src/plugins/intel_gpu/src/plugin/plugin.cpp +++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp @@ -605,6 +605,7 @@ std::vector Plugin::get_supported_properties() const { ov::PropertyName{ov::weights_path.name(), PropertyMutability::RW}, ov::PropertyName{ov::cache_encryption_callbacks.name(), PropertyMutability::WO}, ov::PropertyName{ov::hint::kv_cache_precision.name(), PropertyMutability::RW}, + ov::PropertyName{ov::hint::model.name(), PropertyMutability::WO}, }; return supported_properties;