diff --git a/src/frontends/ir/src/frontend.cpp b/src/frontends/ir/src/frontend.cpp index 37199930ff204f..7259cb78fc577d 100644 --- a/src/frontends/ir/src/frontend.cpp +++ b/src/frontends/ir/src/frontend.cpp @@ -163,7 +163,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector& variants) const return exts; }; - auto create_input_model = [&](std::string weights_path) -> std::shared_ptr { + auto create_input_model = [&](std::filesystem::path weights_path) -> std::shared_ptr { if (provided_model_stream) { return std::make_shared(*provided_model_stream, weights, @@ -243,7 +243,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector& variants) const } } - return create_input_model(ov::util::path_to_string(weights_path)); + return create_input_model(weights_path); } std::shared_ptr FrontEnd::convert(const InputModel::Ptr& model) const { diff --git a/src/frontends/ir/src/input_model.cpp b/src/frontends/ir/src/input_model.cpp index 3794880df4199f..77f105a5b1b944 100644 --- a/src/frontends/ir/src/input_model.cpp +++ b/src/frontends/ir/src/input_model.cpp @@ -208,13 +208,13 @@ class InputModel::InputModelIRImpl { std::unordered_map m_opsets; pugi::xml_node m_root; pugi::xml_document m_xml_doc; - std::string m_weights_path; + std::filesystem::path m_weights_path; public: InputModelIRImpl(std::istream& model, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path) + std::filesystem::path weights_path) : m_weights(weights), m_extensions(extensions), m_weights_path(std::move(weights_path)) { @@ -226,7 +226,7 @@ class InputModel::InputModelIRImpl { InputModelIRImpl(const std::shared_ptr& model, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path) + std::filesystem::path weights_path) : m_weights(weights), m_extensions(extensions), m_weights_path(std::move(weights_path)) { @@ -249,14 +249,14 @@ class InputModel::InputModelIRImpl { InputModel::InputModel(std::istream& model, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path) { + std::filesystem::path weights_path) { _impl = std::make_shared(model, weights, extensions, std::move(weights_path)); } InputModel::InputModel(const std::shared_ptr& model, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path) { + std::filesystem::path weights_path) { _impl = std::make_shared(model, weights, extensions, std::move(weights_path)); } diff --git a/src/frontends/ir/src/input_model.hpp b/src/frontends/ir/src/input_model.hpp index 98e3a0f4dfde5a..dcc0d2e415ca34 100644 --- a/src/frontends/ir/src/input_model.hpp +++ b/src/frontends/ir/src/input_model.hpp @@ -4,6 +4,7 @@ #pragma once +#include #include #include @@ -23,12 +24,12 @@ class InputModel : public ov::frontend::InputModel { InputModel(std::istream& stream, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path = {}); + std::filesystem::path weights_path = {}); InputModel(const std::shared_ptr& model_buf, const std::shared_ptr& weights, const std::unordered_map& extensions, - std::string weights_path = {}); + std::filesystem::path weights_path = {}); std::shared_ptr convert(); }; diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index 2c82ec3898f72e..eca783732c2a0d 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -882,7 +882,8 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< const auto& rt_info = model->get_rt_info(); auto weights_path = rt_info.find("__weights_path"); if (weights_path != rt_info.end()) { - parsed.m_config[ov::weights_path.name()] = weights_path->second; + parsed.m_config[ov::weights_path.name()] = + ov::util::path_to_string(weights_path->second.as()); } } diff --git a/src/plugins/intel_gpu/src/runtime/execution_config.cpp b/src/plugins/intel_gpu/src/runtime/execution_config.cpp index f1f1c37275a078..c5214ee7ac21d1 100644 --- a/src/plugins/intel_gpu/src/runtime/execution_config.cpp +++ b/src/plugins/intel_gpu/src/runtime/execution_config.cpp @@ -26,6 +26,7 @@ #include "openvino/runtime/plugin_config.hpp" #include "openvino/runtime/properties.hpp" #include "openvino/runtime/weightless_properties_utils.hpp" +#include "openvino/util/file_util.hpp" #include "ov_ops/dynamic_quantize.hpp" #include "ov_ops/rms.hpp" #include "transformations/utils/utils.hpp" @@ -40,7 +41,7 @@ ov::RTMap get_rt_info(const ov::Model& model) { rt_info = model.get_rt_info("runtime_options"); if (model.has_rt_info("__weights_path")) { - rt_info[ov::weights_path.name()] = model.get_rt_info("__weights_path"); + rt_info[ov::weights_path.name()] = ov::util::path_to_string(model.get_rt_info("__weights_path")); } return rt_info; } diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cpp index 062fd82ef643ab..b71516e416eee5 100644 --- a/src/plugins/template/src/plugin.cpp +++ b/src/plugins/template/src/plugin.cpp @@ -231,8 +231,8 @@ std::shared_ptr ov::template_plugin::Plugin::import_model( if (auto m = model_hint->second.as>()) { if (m->has_rt_info("__weights_path")) { AnyMap rt_info; - auto p = m->get_rt_info("__weights_path"); - rt_info[ov::weights_path.name()] = m->get_rt_info("__weights_path"); + rt_info[ov::weights_path.name()] = + ov::util::path_to_string(m->get_rt_info("__weights_path")); weights = get_model_weights(rt_info); } } diff --git a/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp b/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp index 8a3a63bc279567..4ff3ee2cce9859 100644 --- a/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp +++ b/src/tests/functional/base_func_tests/include/behavior/compiled_model/compiled_model_base.hpp @@ -1,5 +1,5 @@ // Copyright (C) 2018-2026 Intel Corporation -// SPDX-License-Identifcorer: Apache-2.0 +// SPDX-License-Identifier: Apache-2.0 // #include @@ -1074,7 +1074,7 @@ TEST_P(OVCompiledModelBaseTest, use_blob_hint_has_priority_over_cache_but_weight compiled_model.export_model(blob_file); } { - model->get_rt_info()["__weights_path"] = w_file_path.string(); + model->get_rt_info()["__weights_path"] = w_file_path; configuration.emplace(ov::hint::compiled_blob(ov::read_tensor_data(blob_file_path))); if (target_device == utils::DEVICE_GPU) { configuration.emplace(ov::hint::model(model));