Inferencing in batches with batch transform
SageMaker batch transform is designed to provide offline inference for large datasets. Depending on how you organize the data, SageMaker batch transform can split a single large text file in S3 by lines into a small and manageable size (mini-batch) that would fit into the memory before making inference against the model; it can also distribute the files by S3 key into compute instances for efficient computation. For example, it could send test1.csv
to instance 1 and test2.csv
to instance 2.
To demonstrate SageMaker batch transform, we can pick up from our training example in the previous chapter. In Chapter 6, Detecting ML Bias and Explaining Models with SageMaker Clarify, we showed you how to train a TensorFlow model using SageMaker managed training for a movie review sentiment prediction use case in Getting-Started-with-Amazon-SageMaker-Studio/chapter05/02-tensorflow_sentiment_analysis.ipynb.
We can deploy the trained model to make a...