Putting ML in production can be hard. As you deploy, you may find you are facing challenges such as a need to change the environment from the one the algorithm initially trained in, to a whole new environment. 

This challenge is the idea behind Open Neural Network eXchange (ONNX). In their own words: 

ONNX is an open format built to represent machine learning models. ONNX defines a common set of operators [..] and a common file format to enable AI developers to use models with a variety of frameworks, tools, runtimes, and compilers.”

In other words, ONNX’s purpose is to allow framework interoperability. The idea is to train a model with one tool stack and then to deploy it using another for inference and prediction. More precisely, ONNX is meant to be an intermediary format between two frameworks and not necessarily the final format. This is where its value lies: ONNX allows us to move models between frameworks easily.

As an example, let’s review the steps needed to export an Mxnet model to ONNX. 

We will assume that you are working in an mxnet_p36 environment.

 

 

That’s it. Now it’s up to you to decide on the final framework to load your model in.

Jonathan Chemama

Data Scientist

Read more posts by Jonathan Chemama