Thank you for your help.
Using the paid version of GPT, I successfully trained a Vision Transformer model (vit_base_patch16_224
) for 2 classes and exported it to ONNX format (opset version 14), referring to GPT and the official documentation throughout the process.
- YAML used:
vit_base_bn.yaml
- ALLS file used:
vit_base_bn.alls
- Command used:
hailomz compile --ckpt /hailo_compile/BK/ViT/vit_custom_model.onnx \
--calib-path /hailo_compile/BK/CAS-ViT/classification/data/PetImages_ImageNet/val \
--yaml /hailo_compile/BK/ViT/vit_base_bn.yaml \
--classes 2
An error occurred when I ran the command above.
(venv) root@ca0b87193902:/hailo_compile# hailomz compile --ckpt /hailo_compile/BK/ViT/vit_custom_model.onnx --calib-path /hailo_compile/BK/CAS-ViT/classification/data/PetImages_ImageNet/val --yaml /hailo_compile/BK/ViT/vit_base_bn.yaml --classes 2
<Hailo Model Zoo INFO> Start run for network vit_base_bn ...
<Hailo Model Zoo INFO> Initializing the hailo8 runner...
[info] Translation started on ONNX model vit_base_bn
[info] Restored ONNX model vit_base_bn (completion time: 00:00:01.56)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:12.02)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:26.92)
Traceback (most recent call last):
File "/hailo_test/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 "/hailo_test/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 "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 340, in parse_model_to_hn
converter = ONNXConverter(
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 170, in __init__
super().__init__(
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 27, in __init__
super().__init__(graph, start_node_names, end_node_names)
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 51, in __init__
self._calculate_valid_subgraph_scope()
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 388, in _calculate_valid_subgraph_scope
current_vertex.in_valid_subgraph = True
AttributeError: 'NoneType' object has no attribute 'in_valid_subgraph'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/hailo_test/venv/bin/hailomz", line 33, in <module>
sys.exit(load_entry_point('hailo-model-zoo', 'console_scripts', 'hailomz')())
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/main.py", line 122, in main
run(args)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/main.py", line 111, in run
return handlers[args.command](args)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 219, in compile
_ensure_optimized(runner, logger, args, network_info)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 57, in _ensure_optimized
_ensure_parsed(runner, logger, network_info, args)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/main_driver.py", line 83, in _ensure_parsed
parse_model(runner, network_info, ckpt_path=args.ckpt_path, results_dir=args.results_dir, logger=logger)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/core/main_utils.py", line 95, in parse_model
model_name = translate_model(runner, network_info, ckpt_path, tensor_shapes=start_node_shapes)
File "/hailo_test/hailo_model_zoo/hailo_model_zoo/utils/parse_utils.py", line 28, in translate_model
runner.translate_onnx_model(ckpt_path, model_name,
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_common/states/states.py", line 16, in wrapped_func
return func(self, *args, **kwargs)
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py", line 1158, in translate_onnx_model
parser.translate_onnx_model(
File "/hailo_test/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 "/hailo_test/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 "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py", line 340, in parse_model_to_hn
converter = ONNXConverter(
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py", line 170, in __init__
super().__init__(
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py", line 27, in __init__
super().__init__(graph, start_node_names, end_node_names)
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 51, in __init__
self._calculate_valid_subgraph_scope()
File "/hailo_test/venv/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py", line 388, in _calculate_valid_subgraph_scope
current_vertex.in_valid_subgraph = True
AttributeError: 'NoneType' object has no attribute 'in_valid_subgraph'
I did not modify the .alls
file. In the .yaml
file, the only changes I made were to update the network_path
and alls_script
fields under paths
to absolute paths.
How should I proceed with the compilation?
(The transformed onnx model had no problem with image inference)