Forums - snpe-onnx-to-dlc RuntimeError

6 posts / 0 new
Last post
snpe-onnx-to-dlc RuntimeError
randy.gaul
Join Date: 7 Oct 19
Posts: 8
Posted: Tue, 2019-10-15 13:29

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'!
  • Up0
  • Down0
randy.gaul
Join Date: 7 Oct 19
Posts: 8
Posted: Wed, 2019-10-16 09:47

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.

  • Up0
  • Down0
randy.gaul
Join Date: 7 Oct 19
Posts: 8
Posted: Wed, 2019-10-16 10:04

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".

  • Up0
  • Down0
randy.gaul
Join Date: 7 Oct 19
Posts: 8
Posted: Thu, 2019-10-17 14:34

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.

  • Up0
  • Down0
hrishikesh.hipp...
Join Date: 27 Apr 23
Posts: 1
Posted: Thu, 2023-06-15 10:06

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

  • Up0
  • Down0
980686291
Join Date: 17 Nov 20
Posts: 5
Posted: Mon, 2023-07-10 00:51

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

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.