Forums - ONNX - snpe-onnx-to-dlc not working

4 posts / 0 new
Last post
ONNX - snpe-onnx-to-dlc not working
pgaston
Join Date: 29 Mar 19
Posts: 5
Posted: Thu, 2019-05-16 05:51

Following instructions I successfully installed onnx --> python -c "import onnx" doesn't complain.    I brought in the source and built it that way.   

Now I try an onnx to dlc conversion - I'm currently getting:   (same result without --debug and -d arguments)

~/repos/onnx$ snpe-onnx-to-dlc --m /home/sbace/ace/onnx1/mns-Ox.onnx  --debug -d .
Traceback (most recent call last):
  File "/home/sbace/repos/snpe-1.25.1.310/bin/x86_64-linux-clang/snpe-onnx-to-dlc", line 15, in <module>
    converter = onnx_converter.OnnxConverter()
  File "/home/sbace/repos/snpe-1.25.1.310/lib/python/snpe/converters/onnx/onnx_to_dlc.py", line 61, in __init__
    self.op_info = onnx_translations.OpVersionInfo()
  File "/home/sbace/repos/snpe-1.25.1.310/lib/python/snpe/converters/onnx/onnx_translations.py", line 123, in __init__
    self.setup_op_version_dict()
  File "/home/sbace/repos/snpe-1.25.1.310/lib/python/snpe/converters/onnx/onnx_translations.py", line 126, in setup_op_version_dict
    for schema in defs.get_all_schemas_with_history():
NameError: global name 'defs' is not defined
 

However, in "Environment Setup for ONNX", I'm not sure where the "ONNX directory" location is.    I've tried both the top level git folder and the onnx subfolder.

Further clue - if I try to run snpe-onnx-to-dlc from anywhere other than the top level git folder, I get a segmentation fault.    At least there it responds to -h and the above failure.

 

 

 

  • Up0
  • Down0
jakub.krzeslowski
Join Date: 5 Mar 19
Posts: 1
Posted: Tue, 2019-05-21 05:41

Quote:
NameError: global name 'defs' is not defined

This happens when `from onnx import defs` is not called in lib/python/snpe/converters/onnx/util.py line:16
meaning that onnx is not installed properly when used with snpe

the snpe-onnx-to-dlc script uses 

#!/usr/bin/env python

so check:

$ env python -c "import onnx, snpe"

Running this line caused:
- Segmentation Fault, if wrong python versions are used (onnx in virtualenv)
- "ImportError: No module named onnx", if python path is wrong

  • Up0
  • Down0
zhangboyd
Join Date: 27 Jun 19
Posts: 1
Posted: Sat, 2019-06-29 00:09

I tried with python2.7 and onnx==1.2.1 and protobuf==3.8.0. They work with the latest snpe1.27.1.

  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Tue, 2019-09-10 04:54

Kindly try with the latest NPE SDK, this issue has been resolved.
You can download the latest SDK from here and guidelines for the setting up the SDK are here

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