Hummingbird Usage
Why Hummingbird?
Hummingbird contains an interesting feature for Concrete-ML: it converts many algorithms (see supported algorithms) to tensor computations using a specific backend (torch, torchscript, ONNX and TVM).
Concrete-ML allows the conversion of an ONNX inference to NumPy inference (note that NumPy is always our entry point to run models in FHE).
Usage
We use a simple functionnality of Hummingbird, which is the convert
function that can be imported as follows from the hummingbird.ml
package:
This function can be used to convert a machine learning model to an ONNX as follows:
In theory, we can directly use this onnx_model
within our get_equivalent_numpy_forward
(as long as all operators present in the ONNX model are implemented in NumPy) and get the NumPy inference.
In practice, we have some steps to clean the ONNX and make the graph compatible with our framework such as:
applying quantization where needed
deleting non-FHE friendly ONNX operators, such as Softmax and ArgMax
Last updated