Closed miccio-dk closed 2 years ago
@miccio-dk I tried to run your python script but it didn't generate your model file. Would be great if you could share your ONNX model for us to validate from our end.
Hi Iffa, thanks for looking into this. I just edited the script to include the model instantiation and export, please try and run the updated version (same link). I am also attaching the ONNX model for your convenience: enc.zip
I had checked your model. The benchmark for native ONNX works and it seems to be supported by OpenVINO.
I managed to convert the ONNX into FP16 precision IR (without changing the shape)
The inferencing for FP16(without changing the shape) also works.
However, the static or dynamic conversion failed. The expected input shape is NCHW, so these are what I tried:
Dynamic conversion failed
Static conversion failed
I saw that you were trying to parse 3 shape values, so I tried that also but it also failed:
We'll further investigate this and get back to you with the possible workaround for static/dynamic IR conversion.
Hi Iffa, thanks for looking into this. I just edited the script to include the model instantiation and export, please try and run the updated version (same link). I am also attaching the ONNX model for your convenience: enc.zip
@miccio-dk I've taken a look at the provided onnx model file and such model has single input (with name input.1 and shape [16,80,300]) and single output (with name 2026 and shape [16,576,13]). I've no problems optimizing the model with Model Optimizer (using OpenVINO 2022.1 on Windows host). The following commands all seem to be working correctly, note the _inputshape specified in my last command I got from your generated ONNX model (enc.onnx). Do you observe similar error when optimizing such enc.onnx model with these commands?
$ mo --input_model enc.onnx --data_type FP16 --input input.1 --output 2026
$ mo --input_model enc.onnx --data_type FP16 --input input.1 --output 2026
$ mo --input_model enc.onnx --data_type FP16 --input_shape [16,80,300]
[ SUCCESS ] Generated IR version 11 model.
[ SUCCESS ] XML file: C:\Users\user\Documents\12543-optimizing_a_model_based_on_CoatNet\enc\enc.xml
[ SUCCESS ] BIN file: C:\Users\user\Documents\12543-optimizing_a_model_based_on_CoatNet\enc\enc.bin
[ SUCCESS ] Total execution time: 5.83 seconds.
If I try to use the input shape specified in your initial description (--input "spectrograms[1 80 2048]") with the same ONNX model I get a Runtime Error. Please check what is the expected input shape as defined in your model and make sure it matches when using the Model Optimizer. Hope this helps!
$ mo --input_model enc.onnx --data_type FP16 --input_shape [1,80,2048]
RuntimeError: While validating ONNX node '<Node(Add): Add_416>':
Check 'PartialShape::broadcast_merge_into(pshape, node->get_input_partial_shape(i), autob)' failed at C:\j\workspace\private-ci\ie\build-windows-vs2019@3\b\repos\openvino\src\core\src\op\util\elementwise_args.cpp:30:
While validating node 'v1::Add Add_4015 (onnx::Add_636[0]:f32{1,8,816,816}, onnx::Add_660[0]:f32{1,8,156,156}) -> (dynamic...)' with friendly_name 'Add_4015':
Argument shapes are inconsistent.
Closing this, I hope previous responses were sufficient to help you proceed. Feel free to reopen and provide additional information or ask any questions related to this topic.
Sorry for the late reply, with the help provided above i indeed managed to export and optimize my model using openvino. However, when trying to compile the model for MYRIAD X and run inference on it I get the following:
Traceback (most recent call last):
File "/home/rmiccini/speakerid_training_code/infer.py", line 12, in main
infer(config)
File "/home/rmiccini/speakerid_training_code/speakerid_training/pipelines/infer_pipeline.py", line 61, in infer
compiled_model = core.compile_model(model, params.device)
File "/home/rmiccini/intel/openvino_2022/python/python3.9/openvino/runtime/ie_api.py", line 266, in compile_model
super().compile_model(model, device_name, {} if config is None else config)
RuntimeError: Failed to find reference implementation for `tensor.563` Layer with `GatherElements` Type on constant propagation
System information (version)
Detailed description
When trying to optimize a model based on CoatNet (full model here) I am presented with the following error:
Note that the forward pass of the Encoder model wrapper performs some custom padding to adjust the input shape to the size expected by the CoAtNet backbone. When I explicitly specify an input shape that matches the backbone and doesn't require any padding, i get this other message:
Steps to reproduce
For Encoder instantiation, use the following arguments:
Issue submission checklist