When I tried to run "snpe-onnx-to-dlc -h" I get "RuntimeError: No schema registered for 'ScaledTanh'". Any ideas why?
I have installed ONNX using "python -m pip install onnx" for Python 2.7.12. I am using protobuf version 3.10.0, and ONNX version 1.6.0.
I also tried Python 3.5 with ONNX with no difference.
Here is the full console output.
randy@randy-VirtualBox ~/Desktop/snpe $ snpe-onnx-to-dlc -h Traceback (most recent call last): File "/home/randy/Desktop/snpe/snpe_sdk/bin/x86_64-linux-clang/snpe-onnx-to-dlc", line 11, in from snpe.converters import onnx as onnx_converter File "/home/randy/Desktop/snpe/snpe_sdk/lib/python/snpe/converters/onnx/__init__.py", line 15, in from . import math_translations File "/home/randy/Desktop/snpe/snpe_sdk/lib/python/snpe/converters/onnx/math_translations.py", line 600, in OnnxTranslations.register_translation(OnnxTanhTranslation(), File "/home/randy/Desktop/snpe/snpe_sdk/lib/python/snpe/converters/onnx/math_translations.py", line 589, in __init__ self.register_op_schema('ScaledTanh', [1, 6]) File "/home/randy/Desktop/snpe/snpe_sdk/lib/python/snpe/converters/onnx/onnx_translations.py", line 87, in register_op_schema schema = defs.get_schema(name, version, '') RuntimeError: No schema registered for 'ScaledTanh'!
This is currently a blocking issue for us. Would anyone have any ideas? The next thing I will try is to install different versions of ONNX to see if one is compatible.
Seems like compatability is broken beyond ONNX==1.2.2, as 1.2.2 seems to actually emit the correct help message when using "snpe-onnx-to-dlc -h".
The ONNX converter pauses indefinitely in the middle of conversion on a seemingly innocuous Add node. I did not try debugging, but it looks like maybe an infinite loop or waiting indefinitely for IO. It seems to me that ONNX support is very poor in SNPE. Instead we have moved to using Caffe2 as an intermediary format.
ONNX -> Caffe2 -> DLC
I searched around on the forums, and it seems many people have problems with the ONNX converter, and use the Caffe2 converter instead. My guess is internally Qualcomm devs prefer Caffe2, and end up exercising the Caffe2 codepath more often than the buggy ONNX code path.
I had similar problems working with an older version of the SNPE SDK.
What worked for me was:
1. In the `register_op_schema` method in `onnx_translation.py` ,
changed `except RuntimeError as e` -> `except defs.SchemaError as e`
2. Instead of using python3.5 , I installed python3.5.3, with onnx==1.8.1
3. Try switching to a lower opset version for you ONNX model
comments helps a lot!
this error happens since after onnx>=1.8.1, onnx add SchemaError to wrap Exception
so maybe we should consider both RuntimeError and defs.SchemaError