MLA-C01 Question 196
Select 3You have trained a machine learning model using TensorFlow on your local machine. You now want to deploy this model in AWS SageMaker for inference. Which of the following are valid methods to integrate your locally trained model into SageMaker?
- A
Save the model in a format supported by SageMaker (e.g., TensorFlow SavedModel), upload it to an S3 bucket, and create a SageMaker model pointing to the S3 location.
- B
Convert the model using Amazon SageMaker Neo before uploading it to SageMaker for deployment.
- C
Use the SageMaker Python SDK's
Modelclass to define the model and deploy it directly by specifying the S3 location of the model artifacts. - D
Train the model again in SageMaker using the same dataset to ensure compatibility with SageMaker deployment.
- E
Export your model as a Docker container image, upload it to Amazon Elastic Container Registry (ECR), and use SageMaker to deploy the container as a custom inference endpoint.
Show answer and explanation
Correct answers: A, C, E
Explanation
To integrate a model trained outside SageMaker into SageMaker, you can either upload the model artifacts to an S3 bucket and deploy them using the SageMaker Python SDK or package the model as a Docker container and deploy it using SageMaker's custom inference functionality. Re-training the model or using SageMaker Neo is not required for this purpose.
- A. Correct.
This is a valid approach. SageMaker supports importing pre-trained models stored in an S3 bucket, as long as the model is saved in a format compatible with SageMaker (like TensorFlow SavedModel).
- B. Incorrect.
This is incorrect. While Amazon SageMaker Neo is a tool for optimizing models to run on edge devices, it is not required for deploying a model in SageMaker.
- C. Correct.
This is a valid option. The SageMaker Python SDK provides functionalities to define and deploy pre-trained models using the
Modelclass, where you can specify the S3 location of the model artifacts. - D. Incorrect.
This is incorrect. Re-training the model in SageMaker is unnecessary if the model has already been trained and is compatible with SageMaker deployment requirements.
- E. Correct.
This is a valid method. SageMaker supports custom Docker containers for inference. You can package your model in a Docker image, upload it to Amazon ECR, and use SageMaker to deploy the container as an endpoint.