Error during Hef file Compile

Hello,

I’m having trouble progressing with compiling the HEF file, so I’m here to ask for help.

I have successfully converted the model to ONNX, but I’m encountering an error at the following line of code:

code_line

runner.optimize(calibration_data)

How can I resolve this issue?

I’ll also share the code for the conversion process and the model.

Convert_HEF

import numpy as np
from hailo_sdk_client import ClientRunner

model_name = ‘RTNH_Dense’
onnx_path = ‘RTNH_Dense.onnx’
start_node = [‘dense_input’]
end_node = [‘box_preds’, ‘cls_preds’]
chosen_hw_arch = ‘hailo8’

model_script = ‘’’
model_optimization_flavor(optimization_level=0, compression_level=1)
resources_param(max_control_utilization=0.6, max_compute_utilization=0.6, max_memory_utilization=0.6)
performance_param(fps=20)
‘’’

runner = ClientRunner(hw_arch=chosen_hw_arch)

hn = runner.translate_onnx_model(
model=onnx_path,
start_node_names=start_node,
end_node_names=end_node
)

parsed_model_har_path = f’{model_name}_parsed_model.har’
runner.save_har(parsed_model_har_path)

runner.load_model_script(model_script)

calibration_data = np.random.randn(8, 80, 180, 96).astype(np.float32)

runner.optimize(calibration_data)

quantized_model_har_path = f’{model_name}_quantized_model.har’
runner.save_har(quantized_model_har_path)

hef = runner.compile()

hef_file_name = f’{model_name}.hef’
with open(hef_file_name, ‘wb’) as f:
f.write(hef)

compiled_model_har_path = f’{model_name}_compiled_model.har’
runner.save_har(compiled_model_har_path)

The image above shows the terminal window when the error occurs.

Also, I’m curious if there’s a parameter that allows for early termination of the iterations, as seen in the image above.

Thank you!

Hi @jans1541 !
I would actually try (if you haven’t done that already) with a simpler model_script. e.g., remove these lines:

resources_param(max_control_utilization=0.6, max_compute_utilization=0.6, max_memory_utilization=0.6)
performance_param(fps=20)

There is no real way of stoping an iteration without killing the whole process. But then, why would you want to kill an iterration? You can’t tell if this is irrelevant. As soon as the compiler understands it, the iteration is over.

After moving to a computer with a better CPU and more memory, I’m now encountering a slightly different error. Could you suggest possible ways to fix the error shown in the image?

Thank you for your response.

As you suggested, I modified the model script and executed it.

However, the same error still occurs.

I have tried adjusting various parameters, but the same error persists.

Please help me…

Hi,
Do you maybe have a layer with a huge number of parameters?