Converting the model to ONNX
So far, you’ve seen how we can use Pickle to save a model and then load it in Python. However, Pickle has drawbacks, including being Python-specific. ONNX, on the other hand, is a format that is not Python-specific and can be used in other languages. Let’s see how we can use the ONNX format to work with our model.
We need to solve our task in two steps:
- Convert the model to ONNX format.
- Load the model and create a REST API in JavaScript.
Creating a model in ONNX format
Because we’re using a notebook, we need to install the dependencies, import the libraries we need, and then convert the model to ONNX format.
[Prompt]
What dependencies do I need for ONNX? Show me the Python code for installing those dependencies.
[End of prompt]
[Prompt response]
! pip install skl2onnx
[End of response]
[Prompt]
Show me how to import the libraries I need for ONNX and show me how to...