Model Export
When the model is training, all the data is stored in the memory (CPU's or GPU's). We need a way to save the model to disk to persist the model and use it later. This is where model export comes in.
In stead of just saving the model's parameters, we also want to save the model's structure. So next time when we load the model, we don't need the code who build the model and run the code again.
In modern deep learning, model export has more advantages than just saving the model's parameters and structure. Inference has different design purpose than training. In inference, we need to optimize the inference speed. By using model export, we can output the model in a format that can be optimized for inference.
There are many formats for model export, including ONNX and TensorFlow. In TensorWeaver, we use ONNX as the format for model export.
What is ONNX?
ONNX is a popular format for model export. It is a open format for model export. It is supported by many deep learning frameworks, including TensorFlow, PyTorch, and MXNet.
Why ONNX?
We choose ONNX because:
- ONNX is a open format, which means it is supported by many deep learning frameworks. Which makes it's valuable to learn. Don't forget, we are a education-first framework. We want our users learn most valuable things that can apply to the real world beyond our framework.
- ONNX is a standard format, which means it is supported by many tools. Which make it's easy to visualize and easy to have reference learning resource.
- ONNX has a good ecosystem. There are many inference engines that support ONNX, like ONNX Runtime, TensorRT, etc. It's very practical to use ONNX in the real world.