Deploying the trained Object2Vec and running inference

Now, let's deploy the trained object2vec model. The SageMaker SDK offers methods so that we can seamlessly deploy trained models:

  1. 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 algorithmregression_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. 

  1. Once the model has been created, ...

Get Hands-On Artificial Intelligence on Amazon Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.