Skip to content

Commit a077c79

Browse files
authored
Release model proto after we have the serialized string to reduce peak memory consumption (#672)
Signed-off-by: bfilipek <[email protected]>
1 parent 9ee331a commit a077c79

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

onnxruntime/core/providers/openvino/backends/basic_backend.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ BasicBackend::BasicBackend(std::unique_ptr<ONNX_NAMESPACE::ModelProto>& model_pr
9898
auto_unified_compile) {
9999
// Unified OV compile_model is efficient when ov model caching is enabled
100100
// Unified OV compile_model API is supported with AUTO from version 2024.3 and above
101-
// Inputs with static dimenstions
101+
// Inputs with static dimensions
102102
// Not enabled for models with external weights and when ep context is set.
103103
const std::string model = model_proto->SerializeAsString();
104+
// we have the serialized string, so we can release model proto to lower the peak memory consumption
105+
model_proto.reset();
104106
exe_network_ = OVCore::Get()->CompileModel(model,
105107
hw_target,
106108
device_config,

0 commit comments

Comments
 (0)