Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CORE] Add MODEL_PTR to config only if plugin supports it (#29530)

Tomasz Krupadf4018090c90
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp
index a3d3f1248bf..06cef1c95e8 100644
--- a/src/inference/src/dev/core_impl.cpp
+++ b/src/inference/src/dev/core_impl.cpp
@@ -1478,16 +1478,16 @@ ov::SoPtr<ov::ICompiledModel> 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 d14b0a45eef..3f9bf4e412a 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<ov::PropertyName> 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;