MLS-C01 Question 277
Select 3You are deploying a machine learning model using Amazon SageMaker and need to containerize your model to ensure it adheres to your organization's deployment pipeline. Which of the following steps are necessary to create a Docker container for your model and deploy it to SageMaker?
- A
Write a Dockerfile that defines the environment and dependencies for the model.
- B
Build the Docker image and push it to Amazon Elastic Container Registry (ECR).
- C
Set up a SageMaker inference pipeline to directly reference the Dockerfile.
- D
Ensure the Docker container includes a script to handle model loading and inference requests.
- E
Configure the Amazon SageMaker training job to use the custom Docker image directly.
Show answer and explanation
Correct answers: A, B, D
Explanation
To deploy a custom machine learning model to Amazon SageMaker using Docker, you need to create a Docker container with a Dockerfile that specifies the environment and dependencies. This container must also include a script to handle inference requests. After building the image, it must be pushed to Amazon Elastic Container Registry (ECR) for SageMaker to reference it. SageMaker cannot directly reference Dockerfiles or use inference containers for training jobs.
- A. Correct.
Correct: Writing a Dockerfile is essential for defining the environment, dependencies, and behavior of the container that will host your model.
- B. Correct.
Correct: Once the Docker image is created, it must be pushed to Amazon ECR so SageMaker can access and use it.
- C. Incorrect.
Incorrect: SageMaker inference pipelines do not directly reference Dockerfiles; they work with deployed images hosted on services like ECR.
- D. Correct.
Correct: The Docker container must include a script (often called 'inference.py') that handles loading the model and processing inference requests.
- E. Incorrect.
Incorrect: SageMaker training jobs do not directly use custom inference images; they are used for hosting endpoints or batch transforms. Training jobs require a separate process and setup.