Parameter list and descriptions for mo.convert_model() method in docstring (#16459)
* Added convert_model() params docs. * Added auto-generating of most cli params. * Added auto-generating of cli params. * Small correction. * Removed wrong change. * Corrected default values. * Fixed errors, added tests. * Small correction. * Corrected params descriptions, moved cli specific params to separate file. * Moved params specifics to utils/help.py.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from openvino.tools.mo import convert_model
|
||||
|
||||
if __name__ == "__main__":
|
||||
convert_model(help=True)
|
||||
@@ -0,0 +1,39 @@
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from openvino.tools.mo import mo
|
||||
from openvino.tools.mo.utils.cli_parser import get_mo_convert_params
|
||||
from pathlib import Path
|
||||
|
||||
from common.utils.common_utils import shell
|
||||
|
||||
|
||||
class TestSubprocessMoConvert(unittest.TestCase):
|
||||
def test_mo_convert(self):
|
||||
mo_convert_params = get_mo_convert_params()
|
||||
|
||||
# Test cli tool help
|
||||
mo_path = Path(mo.__file__).parent
|
||||
mo_runner = mo_path.joinpath('main.py').as_posix()
|
||||
params = [sys.executable, mo_runner, "--help"]
|
||||
_, mo_output, _ = shell(params)
|
||||
|
||||
# We don't expect PyTorch specific parameters to be in help message of the MO tool.
|
||||
for group in mo_convert_params:
|
||||
if group == 'Pytorch-specific parameters:':
|
||||
continue
|
||||
for param_name in group:
|
||||
assert param_name in mo_output
|
||||
|
||||
# Test Python API help
|
||||
mo_help_file = os.path.join(os.path.dirname(__file__), "mo_convert_help.py")
|
||||
params = [sys.executable, mo_help_file]
|
||||
_, mo_output, _ = shell(params)
|
||||
|
||||
for group in mo_convert_params:
|
||||
for param_name in group:
|
||||
assert param_name in mo_output
|
||||
Reference in New Issue
Block a user