Hailo Support
Compile ONNX models for Hailo chips and upload the result to the AI Manager Cloud.
Hailo-8
Experimental
x86_64, aarch64
Ubuntu 20+
4.18.0, 4.19.0, 4.20.0
Hailo-8L
Experimental
x86_64, aarch64
Ubuntu 20+
4.18.0, 4.19.0, 4.20.0
Deploying to Hailo chips requires compiling ONNX models to Hailo-ONNX format. Because this compilation process is difficult to automate in the cloud, the model is compiled locally, then the compiled Hailo-ONNX file is uploaded to the AI Manager Cloud.
Compiling an ONNX Model: Requirements
Python 3.8
Python environment
Hailo Dataflow compiler and HailoRT Python API installed in that environment
A set of calibration images (similar to images used to train the model)
Compiling an ONNX Model: Example
This example covers the compilation steps for a Yolov4-tiny model trained on the COCO dataset. Most instructions apply to other ONNX models as well, though some steps require adjustments depending on the model.
To compile the model, run the Python script below after changing the ONNX path.
The code performs the following tasks:
it transpiles the ONNX model to another format optimized for Hailo,
it quantizes and optimizes the model using the supplied set of calibration images,
it compiles the model to a HEF and embeds it inside an ONNX file as an operator, while keeping the pre-processing and post-processing intact. This step returns an ONNX file that can have different input and output names and shapes.
Finally, a new metadata field, named
chipis injected in the ONNX to save which Hailo chip the model was optimized for. This is needed by the AI Manager Cloud to determine the target chip of the model.
After completing the steps above, a new ONNX file is generated. The latter needs to have its IO metadata (names & shapes) adjusted. The Python script below is used for that purpose, it creates a new ONNX model with the adjusted inputs and outputs. The idea of the script is to make sure the generated ONNX is conforming to the ONNX requirements for Nx.
Deploying on a Machine with Hailo-8 or Hailo-8L Chips
First, verify that a compatible HailoRT driver is installed. Check this table to confirm the driver version is supported. For general Hailo driver installation, see the Hailo driver installation guide. Registration for the Hailo Dev Zone is required. For the Raspberry Pi AI HAT+ see here for install instructions. For the Raspberry Pi AI Kit see here.
Next, install the AI plugin.
Once complete, the Hailo runtime is selectable when enabling the Nx plugin, as shown below:

After the installation is finished, the Integrations tab looks something like this, with a runtime active and a pipeline assigned:

To manually verify that the Hailo runtime is downloaded and set up, feel free to check out the content of the
inference_enginefolder of the AI Manager and make sure it contains these files: - libhailort.so.4.xx.0 (xx is the minor version of the library) - libonnxruntime_providers_hailo.so - libonnxruntime_providers_shared.so - libRuntimeLibrary.so
Finally, to deploy a model that can be accelerated on the Hailo chip, make sure that it has an
application/x-hailo8(Hailo-8) orapplication/x-hailo8l(Hailo-8L) artifact in the AI Manager Cloud:

application/x-hailo8 or application/x-hailo8l in the model detail page.If that is not the case, manually compile the ONNX model and upload it to the cloud as illustrated in the example above.
Limitations: Number of Parallel Models
The AI Manager can run multiple AI models simultaneously, but each Hailo chip (Hailo-8 or Hailo-8L) runs only one model at a time. The number of concurrent models on a machine is limited by the number of installed Hailo chips.
Monitoring
How to Enable Hailo Monitoring with hailortcli monitor
Monitoring Hailo usage with the hailortcli monitor command requires setting a specific environment variable. Follow these steps:
Edit the Mediaserver Service Configuration:
Add the following line to the
/etc/systemd/system/<service-name>.servicefile to set the necessary environment variable:The updated configuration file should look like this:
Run hailortcli
HAILO_MONITOR=1 hailortcli monitor

PCIe Descriptor Page Size Error
If you encounter the following error (actual page size may vary), it indicates that your host does not support the specified PCIe descriptor page size:
This issue is common on ARM64 devices like the Raspberry Pi AI Kit. To resolve it, add the following configuration to /etc/modprobe.d/hailo_pci.conf. If the file does not exist, create it and set the max_desc_page_size to the value mentioned in the error (e.g., 4096):
Add this configuration by running the following command:
Reboot the machine for the changes to take effect, or reload the driver without rebooting by running these commands:
Experimental .ini Setting
Explicitly setting multiple AI runtime engines is controlled by an .ini file. This .ini file does not exist by default and must be created by the user. Create an empty .ini file by following the Enable .ini Settings instructions for Linux or Windows.
Then restart the Mediaserver on Linux or Windows:
Once the Mediaserver is restarted, the .ini file should be filled with defaults. Each setting should have a description in the .ini file.
Set multiple runtimes through the runtimesPerModel setting:
Last updated