Now, let's deploy the trained object2vec model. The SageMaker SDK offers methods so that we can seamlessly deploy trained models:
- First, we will create a model from the training job using the create_model() method of the SageMaker Estimator object, as shown in the following code:
from sagemaker.predictor import json_serializer, json_deserializer
# create a model using the trained algorithm
regression_model = regressor.create_model(serializer=json_serializer,
deserializer=json_deserializer,content_type='application/json')
To the create_model() method, we passed the type of serializers and deserializers to be used for the payload at the time of inference.
- Once the model has been created, it can be deployed as an endpoint via the deploy() method of the SageMaker Model object, as shown in the following code: