Preparing the SageMaker script mode prerequisites
In this chapter, we will be preparing a custom script to use a pre-trained model for predictions. Before we can proceed with using the SageMaker Python SDK to deploy our pre-trained model to an inference endpoint, we’ll need to ensure that all the script mode prerequisites are ready.
Figure 7.4 – The desired file and folder structure
In Figure 7.4, we can see that there are three prerequisites we’ll need to prepare:
inference.py
requirements.txt
setup.py
We will store these prerequisites inside the scripts
directory. We’ll discuss these prerequisites in detail in the succeeding pages of this chapter. Without further ado, let’s start by preparing the inference.py
script file!
Preparing the inference.py file
In this section, we will prepare a custom Python script that will be used by SageMaker when processing inference requests. Here, we can influence...