Fixed OVC input_model to work with pathlib.Path. (#18955)

This commit is contained in:
Anastasiia Pnevskaia 2023-08-03 14:39:34 +02:00 committed by GitHub
parent 3109d8fd25
commit a064fa6c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -103,9 +103,9 @@ class ConvertImportMOTest(UnitTestWithMockedTelemetry):
with tempfile.TemporaryDirectory(dir=self.test_directory) as tmpdir:
model = self.create_onnx_model()
model_path = save_to_onnx(model, tmpdir)
out_xml = os.path.join(tmpdir, Path("model.xml"))
out_xml = os.path.join(tmpdir, "model.xml")
ov_model = convert_model(input_model=model_path)
ov_model = convert_model(Path(model_path))
serialize(ov_model, out_xml.encode('utf-8'), out_xml.replace('.xml', '.bin').encode('utf-8'))
ir = IREngine(out_xml, out_xml.replace('.xml', '.bin'))

View File

@ -318,7 +318,7 @@ def readable_dirs_or_files_or_empty(paths: [str, list, tuple]):
if isinstance(paths, (list, tuple)):
paths_list = [readable_file_or_dir_or_object(path) for path in paths]
if isinstance(paths, (str, pathlib.Path)):
paths_list = [readable_file_or_dir_or_object(path) for path in paths.split(',')]
paths_list = [readable_file_or_dir_or_object(path) for path in str(paths).split(',')]
return paths_list[0] if isinstance(paths, (list, tuple)) and len(paths_list) == 1 else paths_list
@ -331,7 +331,7 @@ def readable_files_or_empty(paths: [str, list, tuple]):
if isinstance(paths, (list, tuple)):
return [readable_file_or_object(path) for path in paths]
if isinstance(paths, (str, pathlib.Path)):
paths_list = [readable_file_or_object(path) for path in paths.split(',')]
paths_list = [readable_file_or_object(path) for path in str(paths).split(',')]
return paths_list
return paths

View File

@ -78,9 +78,9 @@ class ConvertImportMOTest(UnitTestWithMockedTelemetry):
with tempfile.TemporaryDirectory(dir=self.test_directory) as tmpdir:
model = self.create_onnx_model()
model_path = save_to_onnx(model, tmpdir)
out_xml = os.path.join(tmpdir, Path("model.xml"))
out_xml = os.path.join(tmpdir, "model.xml")
ov_model = convert_model(input_model=model_path)
ov_model = convert_model(Path(model_path))
serialize(ov_model, out_xml.encode('utf-8'), out_xml.replace('.xml', '.bin').encode('utf-8'))
#TODO: check that model is correct