Skip to content

Commit

Permalink
Fix broken stream processed by NPUW
Browse files Browse the repository at this point in the history
  • Loading branch information
MirceaDan99 committed Jan 14, 2025
1 parent 8cdc4ea commit 6be7805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/plugins/intel_npu/src/plugin/src/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "intel_npu/config/config.hpp"
#include "intel_npu/utils/logger/logger.hpp"
#include "openvino/core/version.hpp"
#include "openvino/runtime/shared_buffer.hpp"

namespace {

Expand All @@ -20,10 +21,10 @@ std::streampos getFileSize(std::istream& stream) {
OPENVINO_THROW("Stream is in bad status! Please check the passed stream status!");
}

if (stream.rdbuf()->in_avail() != 0) {
// ov::OwningSharedStreamBuffer scenario
if (dynamic_cast<ov::OwningSharedStreamBuffer*>(stream.rdbuf()) != nullptr) {
return stream.rdbuf()->in_avail() + stream.tellg();
}

const std::streampos streamStart = stream.tellg();
stream.seekg(0, std::ios_base::end);
const std::streampos streamEnd = stream.tellg();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::import_model(std::istream& stream, c
stream.seekg(stream_start_pos);
return ov::npuw::LLMCompiledModel::deserialize(stream, shared_from_this());
}
stream.seekg(stream_start_pos);
stream.seekg(-stream.tellg() + stream_start_pos, std::ios::cur);

// Drop NPUW properties if there are any
ov::AnyMap npu_plugin_properties;
Expand Down

0 comments on commit 6be7805

Please sign in to comment.