Hi,
I’m trying to convert a small model from ONNX to HEF to run on hailo8.
This model has 1 input (float32[ 1, 1024, 57, 150] ) and 1 output (float32[ 1, 19, 57, 450]).
This is the graph of the ONNX model:
All phases of conversion from ONNX to HAR run successfully with the optimization running with the following script:
alls_model_script = [
"model_optimization_flavor(optimization_level=2, compression_level=0, batch_size=1)\n",
"performance_param(compiler_optimization_level=max)\n",
]
It is in the final Compilation step that I got the error:
[error] Failed to produce compiled graph
[error] BackendAllocatorException: Compilation failed: Compiler could not find a valid partition to contexts. Most commom error is: Failed to resolve prepost with 20/23 failures.
Mapping Failed (Timeout, allocation time: 31m 33s)
By analysing the tracelog it seems the compilation fails earlier with a “Failed to resolve prepost” message.
I can’t figure out what this means, as the model is a really simple network and no pre-processing is done (no normalization layers, etc).
I leave here the links to the ONNX file and the HAR file after optimization:
ONNX File
HAR Quantized Model
The compilation command I’m executing and that is failing is just:
runner = ClientRunner(har=quant_model_har_path)
hef = runner.compile()
with open(HEF_model_filename, "wb") as f:
f.write(hef)
Here is the Full tracelog of the Compilation phase:
Tracelog
[2024-08-29 17:21:07.666] [default] [info] Ran from command: "convert_SimpleModelToHailo.py"
[2024-08-29 17:21:07.667] [default] [info] Loading network parameters
[2024-08-29 17:21:07.702] [default] [info] Starting Hailo allocation and compilation flow
[2024-08-29 17:21:07.728] [default] [info] Model name: featcomb
[2024-08-29 17:22:43.871] [default] [info] Trying to solve in single context
[2024-08-29 17:22:46.380] [default] [info] Model fits in single context
[2024-08-29 17:22:46.380] [default] [info] Model fits in single context, trying to increase utilization
[2024-08-29 17:22:46.396] [default] [info] Initial resources counter with: SCs: 43/512, 16bit SCs: 0/512, APUs: 35/160, IAs: 35/256, L3 weights: 136/922, L3 ios: 168/922, LCUs: 35/154
[2024-08-29 17:24:36.071] [default] [info] Converged after 3 iterations
[2024-08-29 17:24:36.071] [default] [info] Final resources: SCs: 45/512, 16bit SCs: 0/512, APUs: 35/160, IAs: 35/256, L3 weights: 136/922, L3 ios: 42/922, LCUs: 35/154
[2024-08-29 17:24:36.071] [default] [info] Trying to apply higher utilization solution
[2024-08-29 17:24:38.969] [default] [info] Running Auto-Merger
[2024-08-29 17:24:41.613] [default] [info] Auto-Merger is done
[2024-08-29 17:25:04.270] [default] [info] Higher utilization solution failed validation: Failed to resolve prepost, skipping to the next one
[2024-08-29 17:25:04.270] [default] [info] Trying to apply higher utilization solution
[2024-08-29 17:25:06.822] [default] [info] Running Auto-Merger
[2024-08-29 17:25:09.317] [default] [info] Auto-Merger is done
[2024-08-29 17:25:28.034] [default] [info] Higher utilization solution failed validation: Failed to resolve prepost, skipping to the next one
[2024-08-29 17:25:31.046] [default] [info] Running Auto-Merger
[2024-08-29 17:25:33.628] [default] [info] Auto-Merger is done
[2024-08-29 17:26:05.595] [default] [info] Single context solution failed, skipping it
[2024-08-29 17:26:05.595] [default] [info] Single context flow failed: Failed to resolve prepost, continuing in multi context
[2024-08-29 17:27:33.101] [default] [info] Finding the best partition to contexts...
[2024-08-29 17:28:43.038] [default] [info] Running Auto-Merger
[2024-08-29 17:28:45.780] [default] [info] Auto-Merger is done
[2024-08-29 17:29:11.254] [default] [info] Iteration #1 - Contexts: 1, Changed: context_0, Fast FPS: 13.3787 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:29:34.075] [default] [info] Iteration #2 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:29:56.956] [default] [info] Iteration #3 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:30:57.728] [default] [info] Iteration #4 - Contexts: 2, Changed: context_0, Fast FPS: 13.324 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:32:19.194] [default] [info] Iteration #5 - Contexts: 2, Changed: context_0, Fast FPS: 13.3241 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:33:19.824] [default] [info] Iteration #6 - Contexts: 2, Changed: context_0, Fast FPS: 13.3241 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:34:21.454] [default] [info] Iteration #7 - Contexts: 2, Changed: context_0, Fast FPS: 13.324 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:35:00.261] [default] [info] Iteration #8 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:36:26.499] [default] [info] Iteration #9 - Contexts: 2, Changed: context_0, Fast FPS: 13.3241 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:40:24.945] [default] [info] Iteration #10 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:42:02.993] [default] [info] Iteration #11 - Contexts: 2, Changed: context_0, Fast FPS: 13.3237 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:42:41.722] [default] [info] Iteration #12 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:43:20.915] [default] [info] Iteration #13 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:44:00.351] [default] [info] Iteration #14 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:44:38.892] [default] [info] Iteration #15 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:47:00.789] [default] [info] Iteration #16 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:47:39.727] [default] [info] Iteration #17 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:48:18.311] [default] [info] Iteration #18 - Contexts: 2, Changed: context_0, Fast FPS: 13.3242 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:53:20.292] [default] [info] Iteration #19 - Contexts: 2, Changed: context_0, Fast FPS: 11.1377 (best: 0), Failed on: Validator failed on node: conv1_defuse_1x1_d0 with Agent infeasible
Validator failed on node: conv1_defuse_1x1_d1 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d0 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d1 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d2 with Agent infeasible
[2024-08-29 17:53:49.729] [default] [info] Iteration #20 - Contexts: 2, Changed: context_0, Fast FPS: 11.0986 (best: 0), Failed on: Validator failed on node: conv1_defuse_1x1_d0 with Agent infeasible
Validator failed on node: conv1_defuse_1x1_d1 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d0 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d1 with Agent infeasible
Validator failed on node: conv2_defuse_1x1_d2 with Agent infeasible
[2024-08-29 17:58:27.286] [default] [info] Iteration #21 - Contexts: 2, Changed: context_0, Fast FPS: 7.46989 (best: 0), Failed on: Validator failed on node: conv1_defuse_1x1_d0 with Agent infeasible
Validator failed on node: conv1_defuse_1x1_d1 with Agent infeasible
[2024-08-29 17:58:41.254] [default] [info] Iteration #22 - Contexts: 2, Changed: context_0, Fast FPS: 12.4548 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:59:04.679] [default] [info] Iteration #23 - Contexts: 2, Changed: context_0, Fast FPS: 12.4508 (best: 0), Failed on: Failed to resolve prepost
[2024-08-29 17:59:04.679] [default] [info] Slowest context (context_0) has 1 layer (input_layer1)
[2024-08-29 17:59:06.451] [default] [info] e[1;41mMapping Failed (Timeout, allocation time: 31m 33s)e[0m
[2024-08-29 17:59:06.451] [default] [info] Builder fail with status 94: Compiler could not find a valid partition to contexts. Most commom error is: Failed to resolve prepost with 20/23 failures.
Mapping Failed (Timeout, allocation time: 31m 33s)
[2024-08-29 17:59:06.451] [default] [info] Compiler could not find a valid partition to contexts. Most commom error is: Failed to resolve prepost with 20/23 failures.
Mapping Failed (Timeout, allocation time: 31m 33s)
I’m using the latest Hailo AI Suite docker with DFC 3.28.
Can someone help or give any recommendation to compile this model ?
Thank you,