Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/frontends/ir/src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
return exts;
};

auto create_input_model = [&](std::string weights_path) -> std::shared_ptr<InputModel> {
auto create_input_model = [&](std::filesystem::path weights_path) -> std::shared_ptr<InputModel> {
if (provided_model_stream) {
return std::make_shared<InputModel>(*provided_model_stream,
weights,
Expand Down Expand Up @@ -243,7 +243,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
}
}

return create_input_model(ov::util::path_to_string(weights_path));
return create_input_model(weights_path);
}

std::shared_ptr<ov::Model> FrontEnd::convert(const InputModel::Ptr& model) const {
Expand Down
12 changes: 6 additions & 6 deletions src/frontends/ir/src/input_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ class InputModel::InputModelIRImpl {
std::unordered_map<std::string, ov::OpSet> 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<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path)
std::filesystem::path weights_path)
: m_weights(weights),
m_extensions(extensions),
m_weights_path(std::move(weights_path)) {
Expand All @@ -226,7 +226,7 @@ class InputModel::InputModelIRImpl {
InputModelIRImpl(const std::shared_ptr<ov::AlignedBuffer>& model,
const std::shared_ptr<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path)
std::filesystem::path weights_path)
: m_weights(weights),
m_extensions(extensions),
m_weights_path(std::move(weights_path)) {
Expand All @@ -249,14 +249,14 @@ class InputModel::InputModelIRImpl {
InputModel::InputModel(std::istream& model,
const std::shared_ptr<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path) {
std::filesystem::path weights_path) {
_impl = std::make_shared<InputModelIRImpl>(model, weights, extensions, std::move(weights_path));
}

InputModel::InputModel(const std::shared_ptr<ov::AlignedBuffer>& model,
const std::shared_ptr<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path) {
std::filesystem::path weights_path) {
_impl = std::make_shared<InputModelIRImpl>(model, weights, extensions, std::move(weights_path));
}

Expand All @@ -274,7 +274,7 @@ std::shared_ptr<ov::Model> InputModel::InputModelIRImpl::convert() {
visitor.on_attribute("net", model);
model->get_rt_info()["version"] = int64_t(version);
if (!m_weights_path.empty())
model->get_rt_info()["__weights_path"] = m_weights_path;
model->get_rt_info()["__weights_path"] = ov::util::path_to_string(m_weights_path);
parse_pre_process(m_root, m_weights, model);

return model;
Expand Down
5 changes: 3 additions & 2 deletions src/frontends/ir/src/input_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <filesystem>
#include <istream>
#include <memory>

Expand All @@ -23,12 +24,12 @@ class InputModel : public ov::frontend::InputModel {
InputModel(std::istream& stream,
const std::shared_ptr<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path = {});
std::filesystem::path weights_path = {});

InputModel(const std::shared_ptr<ov::AlignedBuffer>& model_buf,
const std::shared_ptr<ov::AlignedBuffer>& weights,
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
std::string weights_path = {});
std::filesystem::path weights_path = {});

std::shared_ptr<Model> convert();
};
Expand Down
Loading