Fixed OVC input_model to work with pathlib.Path. (#18955)
This commit is contained in:
parent
3109d8fd25
commit
a064fa6c27
@ -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'))
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user