Skip to content

Commit

Permalink
Fixed verbose param. (openvinotoolkit#21234)
Browse files Browse the repository at this point in the history
  • Loading branch information
popovaan authored Nov 22, 2023
1 parent 3095396 commit 823d327
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tests/layer_tests/ovc_python_api_tests/test_ovc_cli_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def generate_ir_ovc(coverage=False, **kwargs):
# if we omit this argument for FP32, it will be set implicitly to True as the default
elif key == 'compress_to_fp16':
params.append("--{}={}".format(key, value))
elif key == 'verbose':
params.append("--{}".format(key))
elif isinstance(value, bool) and value:
params.append("--{}".format(key))
elif isinstance(value, bool) and not value:
Expand Down Expand Up @@ -176,3 +178,17 @@ def test_ovc_tool_non_existng_output_dir(self):
ov_model = core.read_model(os.path.join(self.tmp_dir, "dir", "test_model.xml"))
flag, msg = compare_functions(ov_model, ref_model, False)
assert flag, msg


def test_ovc_tool_verbose(self):
from openvino.runtime import Core
core = Core()

model_dir, ref_model = self.create_tf_saved_model_dir(self.tmp_dir)

exit_code, stderr = generate_ir_ovc(coverage=False, **{"input_model": model_dir, "output_model": self.tmp_dir, "verbose": ""})
assert not exit_code

ov_model = core.read_model(os.path.join(self.tmp_dir, "test_model.xml"))
flag, msg = compare_functions(ov_model, ref_model, False)
assert flag, msg
4 changes: 3 additions & 1 deletion tools/ovc/openvino/tools/ovc/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,12 @@ def get_model_name_from_args(argv: argparse.Namespace):
raise Error('The directory "{}" is not writable'.format(argv.output_model))
output_dir = argv.output_model

input_model = os.path.abspath(argv.input_model)
input_model = argv.input_model
if isinstance(input_model, (tuple, list)) and len(input_model) > 0:
input_model = input_model[0]

input_model = os.path.abspath(input_model)

if not isinstance(input_model, (str, pathlib.Path)):
return output_dir

Expand Down

0 comments on commit 823d327

Please sign in to comment.