Instead of training the model in a notebook instance, we train the model using the SageMaker infrastructure. In previous chapters, we used built-in estimators, such as BlazingText, XGBoost, and Factorization Machines (FMs). In this section, we will explore how we can build our own TensorFlow models and train them through SageMaker, much like we did with these prebuilt models. To do this, we just have to teach SageMaker how our TensorFlow model should be constructed and comply with some conventions regarding the format, location, and structure of the data. Through a Python script, we can specify all of this.
SageMaker will rely on this Python script to perform the training within SageMaker training instances:
import sagemaker
from sagemaker import get_execution_role
import json
import boto3
from sagemaker.tensorflow import...