Exporting and Importing Models

In this chapter, we will discuss how to save and load model parameters during and after training. This is quite an important issue since real model training can take a very long time (from days to weeks), and we want to be able to save intermediate results and then load them for use in evaluation mode in production.

Such regular save operations can be beneficial in the case of a random application crash. Another substantial feature of any machine learning (ML) framework is its ability to export the model architecture, which allows us to share models between frameworks and makes model deployment easier. The main topic of this chapter is to show how to export and import model parameters such as weights and bias values with different C++ libraries. The second part of this chapter is all about the Open Neural Network Exchange (ONNX) format, which is currently gaining popularity among different ML frameworks and can be used to share trained models. This format is suitable for sharing model architectures as well as model parameters.

The following topics will be covered in this chapter:

  • ML model serialization APIs in C++ libraries
  • Delving into ONNX format
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106