@@ -47,6 +47,7 @@ void printDebugInfo(const ov::CompiledModel& obj) {
4747 continue ;
4848 OPENVINO_SUPPRESS_DEPRECATED_END
4949 std::cout << " " << item2.first << " : " << item2.second .as <std::string>() << std::endl;
50+ }
5051 }
5152 } else {
5253 std::cout << " " << cfg << " : " << prop.as <std::string>() << std::endl;
@@ -100,10 +101,10 @@ OVExeNetwork OVCore::StatefulCompileModel(std::shared_ptr<OVNetwork>& model,
100101 LogBasicModelInfo (model);
101102 }
102103
104+ LOGS_DEFAULT (INFO) << log_tag << " Converting from Stateless OV Model to Stateful OV Model" << std::endl;
103105 bool model_status = IsStateful (model);
104106 LOGS_DEFAULT (INFO) << log_tag << " Model IsStateful() Status:\t " << (model_status ? " True" : " False" );
105107 if (!model_status) {
106- LOGS_DEFAULT (INFO) << log_tag << " Converting from Stateless OV Model to Stateful OV Model" << std::endl;
107108 PatchStatefulDecoder (model);
108109 }
109110
@@ -197,69 +198,15 @@ OVExeNetwork OVCore::ImportModel(std::istream& model_stream,
197198 return OvExceptionBoundary ([&]() {
198199 ov::CompiledModel obj;
199200 obj = core.import_model (model_stream, hw_target, device_config);
200- OVExeNetwork exe (obj, hw_target);
201201#ifndef NDEBUG
202202 printDebugInfo (exe.Get ());
203203#endif
204+ OVExeNetwork exe (obj, hw_target);
204205 return exe;
205206 },
206207 " Exception while Loading Network for graph {}" , name);
207208}
208209
209- OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation (std::istream& model_stream,
210- std::string& hw_target,
211- const ov::AnyMap& device_config,
212- bool enable_causallm,
213- std::filesystem::path model_file_path) {
214- return OvExceptionBoundary ([&]() {
215- OVExeNetwork exe;
216-
217- bool isXML = backend_utils::IsModelStreamXML (model_stream);
218-
219- // Helper function to check if file exists and is readable
220- const auto check_file_access = [&model_file_path](const std::filesystem::path& path) {
221- try {
222- if (!std::filesystem::exists (path) || std::filesystem::is_empty (path)) {
223- ORT_THROW (log_tag + " Required file missing or empty: " + path.string ());
224- }
225- std::ifstream file (path);
226- if (!file) {
227- ORT_THROW (log_tag + " Required file not readable: " + path.string ());
228- }
229- } catch (const std::exception& e) {
230- ORT_THROW (log_tag + " Exception while checking file access for: " + path.string () + " - " + e.what ());
231- }
232- };
233-
234- if (isXML) {
235- // If the model is XML, we need to load it with the XML content in read_model()
236- // where weights from bin file is directly consumed
237- auto xml_file_path = model_file_path.parent_path () / (model_file_path.stem ().string () + " .xml" );
238-
239- check_file_access (xml_file_path);
240-
241- LOGS_DEFAULT (INFO) << log_tag << " Reading OVIR from XML file path: " << xml_file_path.string ();
242-
243- // Load the model explicitly with XML contents
244- std::shared_ptr<ov::Model> model = core.read_model (xml_file_path.string ());
245-
246- if (enable_causallm) {
247- exe = OVCore::Get ()->StatefulCompileModel (model, hw_target, device_config);
248- } else {
249- auto obj = core.compile_model (model, hw_target, device_config);
250- exe = OVExeNetwork (obj, hw_target);
251- }
252- }
253-
254- #ifndef NDEBUG
255- printDebugInfo (exe.Get ());
256- #endif
257- return exe;
258- },
259- " Exception while Loading Network from OVIR model file: {}" , model_file_path.string ());
260- }
261-
262-
263210void OVCore::SetCache (const std::string& cache_dir_path) {
264211 core.set_property (ov::cache_dir (cache_dir_path));
265212}
0 commit comments