Compile swin_tiny

Hi *,
I’m trying to compile a swin_tiny model for hailo8 and I’m stuck at the first step: creating a parseable ONNX. I’ve followed the link to the pretrained swin_tiny classifier from hailo model zoo, downloaded the model and exported it to ONNX:

# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
import onnx
import onnxsim
import torch

processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = AutoModelForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model.to("cuda")

dummy_input = torch.randn(1, 3, 224, 224, device="cuda")
torch.onnx.export(model, dummy_input, "_models/swin_tiny_classifier.onnx", dynamic_axes=None, opset_version=11, optimize=True, verify=True)


onnx_model = onnx.load("_models/swin_tiny_classifier.onnx")  # load onnx model
print("checking model")
onnx.checker.check_model(onnx_model, full_check=True)  # check onnx model
print("model checked ")

Then I simplified the model using

onnxsim _models/swin_tiny_classifier.onnx _models/swin_tiny_classifier.sim.onnx 32 --enable-onnxruntime-optimization --test-input-shape 1,3,224,224

Now when I try to parse the model with

hailo parser onnx --hw-arch hailo8 --har-path swin_tiny_classifier.sim.har _models/swin_tiny_classifier.sim.onnx

I get the following error:

[info] Current Time: 15:49:14, 04/14/25
[info] CPU: Architecture: , Model: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz, Number Of Cores: 16, Utilization: 2.7%
[info] Memory: Total: 31GB, Available: 21GB
[info] System info: OS: Linux, Kernel: 6.12.23-1-lts
[info] Hailo DFC Version: 3.31.0
[info] HailoRT Version: Not Installed
[info] PCIe: No Hailo PCIe device was found
[info] Running `hailo parser onnx --hw-arch hailo8 --har-path swin_tiny_classifier.sim.har _models/swin_tiny_classifier.sim.onnx`
[info] Found a '.' character in net_name, which isn't supported. New net_name is swin_tiny_classifier_sim
[info] Translation started on ONNX model swin_tiny_classifier_sim
[info] Restored ONNX model swin_tiny_classifier_sim (completion time: 00:00:00.24)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:00.90)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:03.25)
Traceback (most recent call last):
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 239, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 320, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 371, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 83, in convert_model
    self._create_layers()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 38, in _create_layers
    self._update_vertices_info()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 320, in _update_vertices_info
    node.update_output_format()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 548, in update_output_format
    self.update_reshape_output_format(input_format)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 344, in update_reshape_output_format
    if self.is_spatial_flatten_reshape():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3502, in is_spatial_flatten_reshape
    if self._is_spatial_flatten_with_features_to_heads_reshape():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3553, in _is_spatial_flatten_with_features_to_heads_reshape
    if self.is_spatial_flatten_features_to_width():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3154, in is_spatial_flatten_features_to_width
    h, w, c = input_shapes[-3:]
ValueError: not enough values to unpack (expected 3, got 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../hailo8/model_quantization/.venv/bin/hailo", line 8, in <module>
    sys.exit(main())
  File ".../hailo8/model_quantization/.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 ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
    return self._run(argv)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
    return args.func(args)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 213, in run
    self._parse(net_name, args, tensor_shapes)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 297, in _parse
    self.runner.translate_onnx_model(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1187, in translate_onnx_model
    parser.translate_onnx_model(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 280, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 320, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 371, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 83, in convert_model
    self._create_layers()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 38, in _create_layers
    self._update_vertices_info()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 320, in _update_vertices_info
    node.update_output_format()
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 548, in update_output_format
    self.update_reshape_output_format(input_format)
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 344, in update_reshape_output_format
    if self.is_spatial_flatten_reshape():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3502, in is_spatial_flatten_reshape
    if self._is_spatial_flatten_with_features_to_heads_reshape():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3553, in _is_spatial_flatten_with_features_to_heads_reshape
    if self.is_spatial_flatten_features_to_width():
  File ".../hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 3154, in is_spatial_flatten_features_to_width
    h, w, c = input_shapes[-3:]
ValueError: not enough values to unpack (expected 3, got 2)

Adding some debug info I can see that the problematic node is “gemm_output_reshape_new_reshape” with input shape [3136, 96].

I also compared hailo’s onnx file from the model zoo with mine in Netron and could spot some differences although coming from the same pytorch model.
As to why I’m not using the precompiled model from hailo model zoo, ultimatly I want to compile a custom trained swin_tiny.

Any pointer to solve this issue would be helpful or if someone has the code for exporting swin_tiny to ONNX laying around that would be very helpful as well.

Hey @lieberwirth ,

The key part of the error:

ValueError: not enough values to unpack (expected 3, got 2)
...
input shape [3136, 96]

means the model is outputting a 2D tensor where the parser expects something like [H, W, C] or [N, C, H, W].


What’s Going Wrong

The node causing the issue (gemm_output_reshape_new_reshape) is reshaping the tensor in a way that Hailo’s parser can’t interpret — usually because:

  • Spatial dimensions were flattened before feeding into a linear (Gemm) layer.
  • After that, the model tries to reshape again, but from a 2D tensor that’s missing spatial context.

How to Fix It

1. Export with Static Shapes

Avoid using fully dynamic axes during export. Instead, set a fixed batch size and define input shape more clearly:

torch.onnx.export(
    model,
    dummy_input,
    "_models/swin_tiny_classifier.onnx",
    input_names=["input"],
    output_names=["output"],
    opset_version=13,
    dynamic_axes={"input": {0: "batch_size"}}  # Still allows batching, but keeps shape consistent
)

Using opset_version 13 or newer helps with better shape inference.


2. Patch the Problematic Reshape Node

You can use onnx_graphsurgeon to edit the ONNX file and fix or bypass the bad reshape:

import onnx
import onnx_graphsurgeon as gs

model = onnx.load("_models/swin_tiny_classifier.sim.onnx")
graph = gs.import_onnx(model)

for node in graph.nodes:
    if "gemm_output_reshape" in node.name:
        node.op = "Identity"
        node.outputs[0].shape = [1, 96]  # Adjust this to a valid shape for your case

graph.cleanup()
onnx.save(gs.export_onnx(graph), "_models/swin_tiny_classifier.fixed.onnx")

This removes the reshape and keeps the output tensor in a format Hailo’s parser can understand.

Hi @omria,
thank you for your reply.
I found that removing the arguments from onnxsim fixed the above error.

onnxsim _models/swin_tiny_classifier.onnx _models/swin_tiny_classifier.sim.onnx

But hailo parser has run into another error in the ‘self._calculate_shapes(validate_shapes=False)’ step.

Here’s the complete Traceback:

Traceback (most recent call last):
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 239, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 320, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 371, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 92, in convert_model
    self._calculate_shapes(validate_shapes=False)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 207, in _calculate_shapes
    self._layers_graph.calculate_shapes(meta_edges_graph=self._meta_graph, validate_shapes=validate_shapes)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 761, in calculate_shapes
    self.update_input_shapes_from_predecessors(layer)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 827, in update_input_shapes_from_predecessors
    layer.input_shapes = input_shapes
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hn_layers/layer.py", line 541, in input_shapes
    self.set_input_shapes(input_shapes)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hn_layers/conv2d.py", line 565, in set_input_shapes
    raise UnsupportedModelError(
hailo_sdk_common.hailo_nn.exceptions.UnsupportedModelError: Invalid kernel shape for base conv layer base_conv53 (translated from /classifier/Gemm).
Either the input shape doesn't match the kernel shape, or the calculated groups number doesn't match the expected ratio between kernel shape and input shape.
Kernel features: 768 Input features: 49 Groups: 0 Name: base_conv53

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 213, in run
    self._parse(net_name, args, tensor_shapes)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 297, in _parse
    self.runner.translate_onnx_model(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1187, in translate_onnx_model
    parser.translate_onnx_model(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 280, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 320, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 371, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 92, in convert_model
    self._calculate_shapes(validate_shapes=False)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 207, in _calculate_shapes
    self._layers_graph.calculate_shapes(meta_edges_graph=self._meta_graph, validate_shapes=validate_shapes)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 761, in calculate_shapes
    self.update_input_shapes_from_predecessors(layer)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hailo_nn.py", line 827, in update_input_shapes_from_predecessors
    layer.input_shapes = input_shapes
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hn_layers/layer.py", line 541, in input_shapes
    self.set_input_shapes(input_shapes)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_common/hailo_nn/hn_layers/conv2d.py", line 565, in set_input_shapes
    raise UnsupportedModelError(
hailo_sdk_common.hailo_nn.exceptions.UnsupportedModelError: Invalid kernel shape for base conv layer base_conv53 (translated from /classifier/Gemm).
Either the input shape doesn't match the kernel shape, or the calculated groups number doesn't match the expected ratio between kernel shape and input shape.
Kernel features: 768 Input features: 49 Groups: 0 Name: base_conv53

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/hailo8/model_quantization/.venv/bin/hailo", line 8, in <module>
    sys.exit(main())
  File "/hailo8/model_quantization/.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 "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
    return self._run(argv)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
    return args.func(args)
  File "/hailo8/model_quantization/.venv/lib/python3.10/site-packages/hailo_sdk_client/tools/parser_cli.py", line 237, in run
    raise ParserCLIException(str(err).replace("net_input_format", "input_format")) from err
hailo_sdk_client.tools.parser_cli.ParserCLIException: Invalid kernel shape for base conv layer base_conv53 (translated from /classifier/Gemm).
Either the input shape doesn't match the kernel shape, or the calculated groups number doesn't match the expected ratio between kernel shape and input shape.
Kernel features: 768 Input features: 49 Groups: 0 Name: base_conv53

Problem is I can’t find the layer ‘base_conv53’. The swin_tiny model has only one Conv-Layer right after the input ‘base_conv1’. I also tried to identify the layer using the input/output shapes. Adding some debug info the input shape is supposed to be [[-1, 1, 1, 49]] but no layer with this shape exists in the onnx file.

Do you have any pointer on how I can identify the problematic layer?

Hey @lieberwirth ,

You’re hitting a pretty common parsing issue with ONNX models—especially with stuff like Swin Transformer or ViT. Basically, Hailo’s parser expects a certain shape for conv layers, but some models (especially after conversion) do weird things with fully connected layers (GEMM) and shapes.


What’s actually going wrong?

The error says:

UnsupportedModelError: Invalid kernel shape for base conv layer base_conv53 (translated from /classifier/Gemm).
Either the input shape doesn't match the kernel shape, or the calculated groups number doesn't match the expected ratio between kernel shape and input shape.
Kernel features: 768 Input features: 49 Groups: 0 Name: base_conv53
  • base_conv53 is an internal layer name from the Hailo parser. It’s a Conv2D, but it was created from a /classifier/Gemm node in ONNX.
  • Even if your ONNX only shows one Conv, converters often turn GEMM layers into 1x1 Convs for hardware.
  • The input shape here is [1, 1, 49] (without batch). But the kernel expects something totally different.

How to spot the problem

  1. Look at your ONNX in Netron
    You’ll see something like:

    • GlobalAveragePool / ReduceMean
    • Flatten / Reshape
    • Gemm (or maybe MatMul + Add)

    The trouble starts when the GEMM gets mapped to Conv2D with mismatched shapes.

  2. Find where the shapes don’t line up

    • You’ll see the input is [1, 1, 49] (ignoring batch).
    • But the kernel is expecting 768 features, not 49.

Have you solved this problem? I also met it and would like to ask you for advice.

Sadly no. I tried to fix the shapes but got into all sorts of onnx problems and left it there. But one day I’ll probably have to pick it back up again. If you get any further I would appreciate it if you post your findings.

Ok, thank you for your reply, I will let you know as soon as I solve it.

1 Like

My problem is solved, here is the solution. You can see if it can help you.

That “invalid-kernel-shape” error happens because our parser expects standard 4-D convolutions, but your 5-D multi-view input is confusing the kernel-shape checker.

Solution: Convert to 4-D before export

Here’s what you need to do:

Modify your PyTorch model: Remove the .view(N * V, …) operation and make your model accept pure 4-D input of shape (N * V, C, H, W) instead of 5-D

Collapse dimensions during export: Flatten your batch and view dimensions into a single batch dimension before exporting to ONNX

Use ONNX simplifier: Run the exported model through onnx-simplifier to clean up any reshape operations that might trip up our parser

Standard translation: With the 4-D model, you can use our normal ONNX to HAR translation without any special flags

Let me know if you need any clarification!

1 Like

I came around giving it another try. This time I used a solider_reid model which uses swin_tiny as backbone and also upgraded hailo dataflow compiler to 3.32.0.

I exported the solider_reid to onnx, simplified and tested it. The accuracies are the same as the original model.

Now parsing it with ‘hailo parser onnx‘ resulted in a new error:

root@fc41270bb3d8:/workspace# hailo parser onnx pretrained_model/solider_reid/swin_tiny_market.sim.onnx --net-name solider_reid --har-path pretrained_model/solider_reid/swin_tiny_market.onnx.parse.har --hw-arch hailo8
[info] No GPU chosen, Selected GPU 0
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1754923216.608284   15083 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1754923216.614069   15083 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
[info] Current Time: 14:40:22, 08/11/25
[info] CPU: Architecture: x86_64, Model: Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz, Number Of Cores: 40, Utilization: 33.3%
[info] Memory: Total: 187GB, Available: 147GB
[info] System info: OS: Linux, Kernel: 6.1.0-37-amd64
[info] Hailo DFC Version: 3.32.0
[info] HailoRT Version: Not Installed
[info] PCIe: No Hailo PCIe device was found
[info] Running `hailo parser onnx pretrained_model/solider_reid/swin_tiny_market.sim.onnx --net-name solider_reid --har-path pretrained_model/solider_reid/swin_tiny_market.onnx.parse.har --hw-arch hailo8`
[info] Translation started on ONNX model solider_reid
[info] Restored ONNX model solider_reid (completion time: 00:00:00.53)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:02.09)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:08.60)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 235, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 316, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 359, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/translator.py", line 82, in convert_model
    self._create_layers()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 39, in _create_layers
    self._add_direct_layers()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 121, in _add_direct_layers
    self._layer_callback_from_vertex(vertex)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 528, in _layer_callback_from_vertex
    consumed_vertices = self._create_slice_layer(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 1855, in _create_slice_layer
    h_slice, w_slice, f_slice, groups, consumed_vertices = info_func()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 4167, in get_gather_slice_info
    f_slice = [index[0] * slice_length, (index[0] + 1) * slice_length]
TypeError: can only concatenate list (not "int") to list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/hailo", line 7, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/tools/cmd_utils/main.py", line 111, in main
    ret_val = client_command_runner.run()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 68, in run
    return self._run(argv)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/tools/cmd_utils/base_utils.py", line 89, in _run
    return args.func(args)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/tools/parser_cli.py", line 212, in run
    self._parse(net_name, args, tensor_shapes)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/tools/parser_cli.py", line 298, in _parse
    self.runner.translate_onnx_model(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/runner/client_runner.py", line 1192, in translate_onnx_model
    parser.translate_onnx_model(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 276, in translate_onnx_model
    parsing_results = self._parse_onnx_model_to_hn(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 316, in _parse_onnx_model_to_hn
    return self.parse_model_to_hn(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 359, in parse_model_to_hn
    fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/translator.py", line 82, in convert_model
    self._create_layers()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 39, in _create_layers
    self._add_direct_layers()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 121, in _add_direct_layers
    self._layer_callback_from_vertex(vertex)
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 528, in _layer_callback_from_vertex
    consumed_vertices = self._create_slice_layer(
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 1855, in _create_slice_layer
    h_slice, w_slice, f_slice, groups, consumed_vertices = info_func()
  File "/usr/local/lib/python3.10/dist-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py", line 4167, in get_gather_slice_info
    f_slice = [index[0] * slice_length, (index[0] + 1) * slice_length]
TypeError: can only concatenate list (not "int") to list

I debugged a little and ‘index’ is actually a nested list (or 2D) which is why it fails. Again unsure how to pursue.

If somebody wants try the model just dm me.

Hey @lieberwirth ,

Can you send me the model to check it out ? i think we can try to flatten the indices in ONNX to fix this !