The hb_compile Tool

The hb_compile tool is a tool provided by Horizon to map floating-point model to quantized model with validation function and model modification function, covering the whole process of PTQ model.

Based on the floating-point model, yaml configuration file (optional) and calibration data (optional), the model is optimized, calibrated, quantized, modified and compiled, and the final *.hbm model is generated on the board.

The hb_compile tool conversion process and the outputs of each phase are shown below:

hb_compile_introduction

Support Range

  • It supports the verification, quantization, and compilation of the floating-point model.
  • It supports the modification and compilation of the HBIR model.

Usage Scenarios

The hb_compile tool supports three usage scenarios: model validation, model quantized compilation, model modification and HBIR model compilation.

  • Model Checking: According to the provided floating-point model (caffe/onnx) and model information, return model checking results and error reporting information.
  • Model Quantized Compilation: According to the provided floating-point model (caffe/onnx) and yaml configuration file (optional), the model is quantized compilation to generate the intermediate stage onnx model file as well as hbm model that can be used for on-board deployment.
  • Model Modification and HBIR Model Compilation: Support for operations such as removing nodes from HBIR model and compiling HBIR model.