Hello,
I’m trying to convert a model with a ConvNext Backbone to HEF.
I’ve already exported my model to ONNX using:
torch.onnx.export(my_pt_model,
sample_input,
onnx_model_path,
export_params=True,
opset_version=15,
training=torch.onnx.TrainingMode.PRESERVE,
do_constant_folding=False,
input_names=['input'],
output_names=['output'])
When I try parsing the ONNX model using:
hailo parser onnx /my/model.onnx --net-name model --har-path /my/model.har --hw-arch hailo8
I get this error message:
Traceback (most recent call last):
File "/venv/bin/hailo", line 8, in <module>
sys.exit(main())
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/main.py", line 111, in main
ret_val = client_command_runner.run()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
return self._run(argv)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
return args.func(args)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 216, in run
raise ParsingWithRecommendationCLIException(
hailo_sdk_client.tools.parser_cli.ParsingWithRecommendationCLIException: Parsing failed. The errors found in the graph are:
UnsupportedShuffleLayerError in op /backbone/features.1/features.1.0/block/block.6/Transpose: Failed to determine type of layer to create in node /backbone/features.1/features.1.0/block/block.6/Transpose
[...]
Please try to parse the model again, using:
hailo parser onnx /my/model.onnx --net-name model --har-path /my/model.har --hw-arch hailo8 --end-node-names "/backbone/features.5/features.5.0/stochastic_depth/Div" [...]
If I try to parse my model with the recommended command I get this message:
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 220, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
self._create_layers()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
self._add_direct_layers()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 187, in _add_direct_layers
raise ParsingWithRecommendationException(
hailo_sdk_client.model_translator.exceptions.ParsingWithRecommendationException: Parsing failed. The errors found in the graph are:
UnsupportedShuffleLayerError in op /backbone/features.1/features.1.0/block/block.6/Transpose: Failed to determine type of layer to create in node /backbone/features.1/features.1.0/block/block.6/Transpose
[...]
Please try to parse the model again, using these end node names: /backbone/features.1/features.1.0/block/block.5/Add, [...]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 188, in run
runner = self._parse(net_name, args, tensor_shapes)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 251, in _parse
runner.translate_onnx_model(
File "/venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
return func(self, *args, **kwargs)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
parser.translate_onnx_model(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 260, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 351, in parse_model_to_hn
fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 79, in convert_model
self._create_layers()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 34, in _create_layers
self._add_direct_layers()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 187, in _add_direct_layers
raise ParsingWithRecommendationException(
hailo_sdk_client.model_translator.exceptions.ParsingWithRecommendationException: Parsing failed. The errors found in the graph are:
UnsupportedShuffleLayerError in op /backbone/features.1/features.1.0/block/block.6/Transpose: Failed to determine type of layer to create in node /backbone/features.1/features.1.0/block/block.6/Transpose
[...]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 220, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 352, in parse_model_to_hn
hailo_nn = fuser.convert_model()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/fuser/fuser.py", line 106, in convert_model
self._finalize_fused_model()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/fuser/fuser.py", line 456, in _finalize_fused_model
self._output_graph.update_output_layers_order(self._end_node_names)
File "/venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 904, in update_output_layers_order
raise InvalidHNError(
hailo_sdk_common.hailo_nn.exceptions.InvalidHNError: The original node name /backbone/features.3/features.3.0/stochastic_depth/Div in end_node_names is missing in the HN.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/bin/hailo", line 8, in <module>
sys.exit(main())
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/main.py", line 111, in main
ret_val = client_command_runner.run()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
return self._run(argv)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
return args.func(args)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 206, in run
runner = self._parse(net_name, args, tensor_shapes)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 251, in _parse
runner.translate_onnx_model(
File "/venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
return func(self, *args, **kwargs)
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
parser.translate_onnx_model(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 260, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 300, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 352, in parse_model_to_hn
hailo_nn = fuser.convert_model()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/fuser/fuser.py", line 106, in convert_model
self._finalize_fused_model()
File "/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/fuser/fuser.py", line 456, in _finalize_fused_model
self._output_graph.update_output_layers_order(self._end_node_names)
File "/venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 904, in update_output_layers_order
raise InvalidHNError(
hailo_sdk_common.hailo_nn.exceptions.InvalidHNError: The original node name /backbone/features.3/features.3.0/stochastic_depth/Div in end_node_names is missing in the HN.
The documentation mentions some limitations with transpose operations regarding sizes over 1.5MB so I tried using a (1, 3, 128, 128) sized input instead of (1, 3, 1920, 1080) for my ONNX export.
However I still get the same error message.
Using different opset versions (8, 15, 17) didn’t change anything either.
Is there a way to deal with these transpose operations?