Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Release 2020.1 bug report - fusing replacer

Klinke__Addison
Beginner
726 Views

Hello,

I have an ONNX model exported from PyTorch that I'd like to optimize with OpenVino. Initially I was using branch 2019_R1.0.1 of DLDT, but my ONNX graph uses the slice operator which (as discussed here) was not supported by OpenVino back then. I saw that the latest list of supported ONNX operators did include slice though, so I decided to try optimizing with release 2020.1, but that gave me an internal error (included at the end of this post)

Environment details:

  • Docker image based off nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 (minimal additions, but I can provide the full Dockerfile if needed)
  • Pip install the following for Python3
    • onnx 1.6.0
    • defusedxml 0.5.0
    • test-generator 0.1.1
    • protobuf 3.6.1
    • networkx 2.3
  • PyTorch 1.4.0 exporting with ONNX operator set version 9

Optimizer command:

python3 mo.py --input_model model.onnx --input_shape [1,3,68,136]

Full bug report:

[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Exception occurred during running replacer "fusing (<class 'extensions.middle.fusings.Fusing'>)": 
[ ERROR ]  Traceback (most recent call last):
  File "/opt/openvino/model-optimizer/mo/utils/class_registration.py", line 285, in apply_transform
    replacer.find_and_replace_pattern(graph)
  File "/opt/openvino/model-optimizer/extensions/middle/fusings.py", line 55, in find_and_replace_pattern
    for_graph_and_each_sub_graph_recursively(graph, fuse_pad)
  File "/opt/openvino/model-optimizer/mo/middle/pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "/opt/openvino/model-optimizer/mo/middle/passes/conv.py", line 73, in fuse_pad
    action=pad_op_transform
  File "/opt/openvino/model-optimizer/mo/middle/pattern_match.py", line 95, in apply_pattern
    action(graph, match)
  File "/opt/openvino/model-optimizer/mo/middle/passes/conv.py", line 46, in pad_op_transform
    if np.any(pads[get_features_dim(op.graph.graph['layout'], input_tensor_dims)] != 0) or \
  File "/opt/openvino/model-optimizer/mo/front/common/layout.py", line 86, in get_features_dim
    assert 4 <= shape_len <= 5
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/openvino/model-optimizer/mo/main.py", line 314, in main
    return driver(argv)
  File "/opt/openvino/model-optimizer/mo/main.py", line 281, in driver
    ret_res = emit_ir(prepare_ir(argv), argv)
  File "/opt/openvino/model-optimizer/mo/main.py", line 246, in prepare_ir
    graph = mo_onnx.driver(argv)
  File "/opt/openvino/model-optimizer/mo/pipeline/onnx.py", line 72, in driver
    class_registration.ClassType.BACK_REPLACER
  File "/opt/openvino/model-optimizer/mo/utils/class_registration.py", line 324, in apply_replacements
    num_transforms=len(replacers_order))
  File "/opt/openvino/model-optimizer/mo/utils/logger.py", line 124, in wrapper
    function(*args, **kwargs)
  File "/opt/openvino/model-optimizer/mo/utils/class_registration.py", line 309, in apply_transform
    )) from err
Exception: Exception occurred during running replacer "fusing (<class 'extensions.middle.fusings.Fusing'>)": 

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------

 

0 Kudos
5 Replies
Sahira_Intel
Moderator
726 Views

Hi Addison,

Can you please send me your model so I can take a look at it? If you'd like to share the model privately, I can send you a PM instead. I can submit a bug report if I run into the same errors. 

Best Regards,

Sahira 

0 Kudos
Klinke__Addison
Beginner
726 Views

Hi Sahria, 

Thank you for the reply. Yes, please send me a PM

0 Kudos
Sahira_Intel
Moderator
726 Views

Hi Addison,

I have sent you a PM, please respond there.

Best,

Sahira 

0 Kudos
Klinke__Addison
Beginner
726 Views

I replied through the PM with a Dockerfile and ONNX model you can use to reproduce. Please let me know if there are any other resources you need

0 Kudos
Klinke__Addison
Beginner
726 Views

Hi Sahira,

I found a work-around to the fusing replacer bug - it involved using a different PyTorch implementation of causal convolutions. However, I still think the original approach should work because it generates a valid ONNX model whose operators are all supported by OpenVino.

Now, I have a valid IR model (.bin and .xml) but they give an error when using the Python inference engine API. I sent additional details on our private thread, and would appreciate if you can review.

Thank you,

Addison

0 Kudos
Reply