Forums - converting onnx to dlc

3 posts / 0 new
Last post
converting onnx to dlc
odoetr33
Join Date: 17 Mar 20
Posts: 1
Posted: Tue, 2020-04-07 23:32

I got this error message converting onnx to dlc.

- python 3.5.2

- onnx 1.3

- snpe 1.36

- I checked that the slice layer have 'starts' attribute. but the converter could not find the attribute.

- in onnx >= 1.5,  I got this error "RuntimeError: No schema registered for 'ScaledTanh'!". related issue https://developer.qualcomm.com/forum/qdn-forums/software/qualcomm-neural-processing-sdk/67267, onnx doesn't support python 3.4. 

$ snpe-onnx-to-dlc --input_network xxxxx.onnx --output_path xxxx.dlc
Traceback (most recent call last):
File "/home/you/snpe-sdk/lib/python/snpe/converters/onnx/util.py", line 144, in extract_attributes
ret[name] = KNOWN_ATTRIBUTE_DEFAULTS[name]
KeyError: 'starts'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/you/snpe-sdk/lib/python/snpe/converters/onnx/onnx_to_ir.py", line 124, in convert
self.graph)
File "/home/you/snpe-sdk/lib/python/snpe/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
return translation.apply_method(method_name, *args)
File "/home/you/snpe-sdk/lib/python/snpe/converters/common/converter_ir/translation.py", line 17, in apply_method
return self.indexed_methods[method_name](*args)
File "/home/you/snpe-sdk/lib/python/snpe/converters/common/converter_ir/translation.py", line 120, in add_op
op = self.extract_parameters(src_op, graph)
File "/home/you/snpe-sdk/lib/python/snpe/converters/onnx/data_translations.py", line 467, in extract_parameters
params = extract_attributes 

$ snpe-onnx-to-dlc --input_network xxx.onnx --output_path xxx.dlc --input_type "input" image --input_encoding "input" other --debug
2020-04-07 20:15:30,970 - 145 - DEBUG_1 - Added buffer named input of shape [1, 5, 256, 256]
2020-04-07 20:15:30,971 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 0 with type Conv
2020-04-07 20:15:30,971 - 138 - DEBUG - DEBUG_RETRIEVE_WEIGHTS, key:
2020-04-07 20:15:30,971 - 138 - DEBUG - Added OpNode with name convolution_0, in_names ['input'], out_names ['886']
2020-04-07 20:15:30,971 - 145 - DEBUG_1 - Added buffer named 886 of shape [1, 3, 256, 256]
2020-04-07 20:15:30,971 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 1 with type Constant
2020-04-07 20:15:30,971 - 174 - WARNING - WARNING_OP_VERSION_NOT_SUPPORTED: Operation Constant Not Supported. Expected operator version: [1], instead got version: [9]
2020-04-07 20:15:30,971 - 138 - DEBUG - Inserting weights for 887
2020-04-07 20:15:30,971 - 138 - DEBUG - Added OpNode with name 887, in_names [], out_names ['887']
2020-04-07 20:15:30,971 - 145 - DEBUG_1 - Added buffer named 887 of shape [1]
2020-04-07 20:15:30,971 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 2 with type Constant
2020-04-07 20:15:30,972 - 174 - WARNING - WARNING_OP_VERSION_NOT_SUPPORTED: Operation Constant Not Supported. Expected operator version: [1], instead got version: [9]
2020-04-07 20:15:30,972 - 138 - DEBUG - Inserting weights for 888
2020-04-07 20:15:30,972 - 138 - DEBUG - Added OpNode with name 888, in_names [], out_names ['888']
2020-04-07 20:15:30,972 - 145 - DEBUG_1 - Added buffer named 888 of shape [1]
2020-04-07 20:15:30,972 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 3 with type Constant
2020-04-07 20:15:30,972 - 174 - WARNING - WARNING_OP_VERSION_NOT_SUPPORTED: Operation Constant Not Supported. Expected operator version: [1], instead got version: [9]
2020-04-07 20:15:30,972 - 138 - DEBUG - Inserting weights for 889
2020-04-07 20:15:30,972 - 138 - DEBUG - Added OpNode with name 889, in_names [], out_names ['889']
2020-04-07 20:15:30,972 - 145 - DEBUG_1 - Added buffer named 889 of shape [1]
2020-04-07 20:15:30,972 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 4 with type Constant
2020-04-07 20:15:30,972 - 174 - WARNING - WARNING_OP_VERSION_NOT_SUPPORTED: Operation Constant Not Supported. Expected operator version: [1], instead got version: [9]
2020-04-07 20:15:30,972 - 138 - DEBUG - Inserting weights for 890
2020-04-07 20:15:30,972 - 138 - DEBUG - Added OpNode with name 890, in_names [], out_names ['890']
2020-04-07 20:15:30,972 - 145 - DEBUG_1 - Added buffer named 890 of shape [1]
2020-04-07 20:15:30,972 - 138 - DEBUG - DEBUG_CONVERTING_NODE: Attempting to convert node 5 with type Slice
2020-04-07 20:15:30,972 - 164 - ERROR - Node : ERROR_ATTRIBUTE_MISSING: Node is missing required attribute starts 

  • Up0
  • Down0
achalhoub
Join Date: 12 May 21
Posts: 6
Posted: Fri, 2021-07-30 06:35

Hello odoetr33,

Did you end up figuring out the solution to this issue by any chance? I am trying to convert an ONNX model to DLC (onnx v1.3.0 (opset 11), Python 3.6.9, snpe-1.52.0.2724) and I am facing a similar error:

 

Traceback (most recent call last):

  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/onnx/onnx_to_ir.py", line 142, in convert
    self.graph)
  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
    return translation.apply_method(method_name, *args, **kwargs)
  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 17, in apply_method
    return self.indexed_methods[method_name](*args, **kwargs)
  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 120, in add_op
    op = self.extract_parameters(src_op, graph)
  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/onnx/data_translations.py", line 846, in extract_parameters
    params = extract_attributes(src_op, schema=self.op_schema())
  File "/home/achalhoub/dev/snpe-1.52.0.2724/lib/python/qti/aisw/converters/onnx/util.py", line 139, in extract_attributes
    raise ValueError(code_to_message.get_error_message("ERROR_ATTRIBUTE_MISSING")(onnx_op.name, name))
ValueError: ERROR_ATTRIBUTE_MISSING: Node Slice_268 is missing required attribute ends
2021-07-30 09:24:57,675 - 183 - ERROR - Node Slice_268: ERROR_ATTRIBUTE_MISSING: Node Slice_268 is missing required attribute ends
 
Please let me know if you have any advice. 
 
Thanks,
Ahmad

 

  • Up0
  • Down0
ap.arunraj
Join Date: 20 Apr 20
Posts: 21
Posted: Mon, 2021-08-02 23:46

Hello,
As you can see from this link, ScaledTanh is removed from ONNX 1.4 onwards. Also you can refer below link for details on supported ONNX operations:
https://developer.qualcomm.com/docs/snpe/supported_onnx_ops.html#onnx_operator_support 

Please provide more info on the model you are trying to convert so that I could try to reproduce the missing attribute error (starts/ends attribute of slice) on my system.

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