@@ -38,7 +38,6 @@ void printDebugInfo(const ov::CompiledModel& obj) {
3838 continue ;
3939 OPENVINO_SUPPRESS_DEPRECATED_END
4040 std::cout << " " << item2.first << " : " << item2.second .as <std::string>() << std::endl;
41- }
4241 }
4342 } else {
4443 std::cout << " " << cfg << " : " << prop.as <std::string>() << std::endl;
@@ -210,29 +209,23 @@ OVExeNetwork OVCore::ImportModel(std::istream& model_stream,
210209}
211210
212211OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation (std::istream& model_stream,
213- std::string hw_target,
214- const ov::AnyMap& device_config,
215- bool enable_causallm,
216- std::filesystem::path context_file_path,
217- std::string name) {
212+ std::string& hw_target,
213+ const ov::AnyMap& device_config,
214+ bool enable_causallm,
215+ std::filesystem::path model_file_path) {
218216 try {
219217 OVExeNetwork exe;
220218
221219 bool isXML = backend_utils::IsModelStreamXML (model_stream);
222220
223- ORT_ENFORCE (!context_file_path.string ().empty (),
224- " The session option ep.context_file_path is not set for EPContext node with OVIR Encapsulation. "
225- " Current value: '" + context_file_path.string () + " '" );
226-
227221 // Helper function to check if file exists and is readable
228- const auto check_file_access = [&context_file_path ](const std::filesystem::path& path) {
222+ const auto check_file_access = [&model_file_path ](const std::filesystem::path& path) {
229223 try {
230- const auto status = std::filesystem::status (path);
231- if (!std::filesystem::exists (status)) {
232- ORT_THROW (log_tag + " Required file missing: " + path.string ());
224+ if (!std::filesystem::exists (path) || std::filesystem::is_empty (path)) {
225+ ORT_THROW (log_tag + " Required file missing or empty: " + path.string ());
233226 }
234227 std::ifstream file (path);
235- if (!file. is_open () ) {
228+ if (!file) {
236229 ORT_THROW (log_tag + " Required file not readable: " + path.string ());
237230 }
238231 } catch (const std::exception& e) {
@@ -243,7 +236,7 @@ OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation(std::istream& model_stream,
243236 if (isXML) {
244237 // If the model is XML, we need to load it with the XML content in read_model()
245238 // where weights from bin file is directly consumed
246- auto xml_file_path = context_file_path .parent_path () / (context_file_path .stem ().string () + " .xml" );
239+ auto xml_file_path = model_file_path .parent_path () / (model_file_path .stem ().string () + " .xml" );
247240
248241 check_file_access (xml_file_path);
249242
@@ -265,9 +258,9 @@ OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation(std::istream& model_stream,
265258#endif
266259 return exe;
267260 } catch (const Exception& e) {
268- ORT_THROW (log_tag + " Exception while Loading Network for graph : " + name + e.what ());
261+ ORT_THROW (log_tag + " Exception while Loading Network from OVIR model file : " + model_file_path. string () + e.what ());
269262 } catch (...) {
270- ORT_THROW (log_tag + " Exception while Loading Network for graph " + name );
263+ ORT_THROW (log_tag + " Exception while Loading Network from OVIR model file: " + model_file_path. string () );
271264 }
272265}
273266
0 commit comments