Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests for openvino failed with Python==3.6 #118

Closed
RunningLeon opened this issue Jan 28, 2022 · 2 comments
Closed

tests for openvino failed with Python==3.6 #118

RunningLeon opened this issue Jan 28, 2022 · 2 comments
Assignees

Comments

@RunningLeon
Copy link
Collaborator

Hi, I'm trying to build mmdeploy with different versions of python. Found tests for openvino failed with Python==3.6.
Could you take a look at this? @SemyonBevzuk

Failed tests

______________________________ test_onnx2openvino ______________________________

    @backend_checker(Backend.OPENVINO)
    def test_onnx2openvino():
        from mmdeploy.apis.openvino import get_output_model_file, onnx2openvino
        pytorch_model = TestModel().eval()
        export_img = torch.rand([1, 3, 8, 8])
        onnx_file = tempfile.NamedTemporaryFile(suffix='.onnx').name
        input_name = get_random_name()
        output_name = get_random_name()
        generate_onnx_file(pytorch_model, export_img, onnx_file, input_name,
                           output_name)
    
        input_info = {input_name: export_img.shape}
        output_names = [output_name]
        openvino_dir = tempfile.TemporaryDirectory().name
>       onnx2openvino(input_info, output_names, onnx_file, openvino_dir)

tests/test_apis/test_onnx2openvino.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
mmdeploy/backend/openvino/onnx2openvino.py:89: in onnx2openvino
    mo_output = run(command, capture_output=True, shell=True, check=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, timeout = None, check = True
popenargs = ('mo --input_model="/tmp/tmpp09w337y.onnx" --output_dir="/tmp/tmp_2wetdld" --output="kKj8yxmdx1" --input="bNBAIKaJrT" --input_shape="[1, 3, 8, 8]" --disable_fusing ',)
kwargs = {'capture_output': True, 'shell': True}

    def run(*popenargs, input=None, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        The other arguments are the same as for the Popen constructor.
    
        If universal_newlines=True is passed, the "input" argument must be a
        string and stdout/stderr in the returned object will be strings rather than
        bytes.
        """
        if input is not None:
            if 'stdin' in kwargs:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
>       with Popen(*popenargs, **kwargs) as process:
E       TypeError: __init__() got an unexpected keyword argument 'capture_output'

/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/subprocess.py:423: TypeError
----------------------------- Captured stderr call -----------------------------
2022-01-28 07:56:51,505 - mmdeploy - INFO - Args for Model Optimizer: mo --input_model="/tmp/tmpp09w337y.onnx" --output_dir="/tmp/tmp_2wetdld" --output="kKj8yxmdx1" --input="bNBAIKaJrT" --input_shape="[1, 3, 8, 8]" --disable_fusing 
------------------------------ Captured log call -------------------------------
INFO     mmdeploy:onnx2openvino.py:88 Args for Model Optimizer: mo --input_model="/tmp/tmpp09w337y.onnx" --output_dir="/tmp/tmp_2wetdld" --output="kKj8yxmdx1" --input="bNBAIKaJrT" --input_shape="[1, 3, 8, 8]" --disable_fusing

More detailed message: github action

@SemyonBevzuk
Copy link
Collaborator

Hi, I will check.

@SemyonBevzuk
Copy link
Collaborator

SemyonBevzuk commented Jan 31, 2022

As I understand it, argument capture_output was added in version 3.7: link.
So for compatibility with 3.6, you can replace this line in file mmdeploy/backend/openvino/onnx2openvino.py:

# mo_output = run(command, capture_output=True, shell=True, check=True)
from subprocess import PIPE
mo_output = run(command, stdout=PIPE, stderr=PIPE, shell=True, check=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants