AWS Certified Machine Learning – SpecialtyMachine Learning Implementation and OperationsHard

A data science team has developed a new image classification model using a custom deep learning framework that is not natively supported by Amazon SageMaker's built-in algorithms or common framework containers (like TensorFlow or PyTorch). They need to deploy this model for real-time inference on SageMaker, ensuring that their unique framework and dependencies are correctly packaged and available at runtime. Which approach should the team take to deploy their model?

  1. AConvert the model to ONNX format and deploy it with SageMaker Neo.
  2. BDeploy the model on an EC2 instance and manage the infrastructure manually.
  3. CBuild a custom Docker image with the framework and dependencies, then use it as a SageMaker inference container.
  4. DUse a SageMaker built-in algorithm container and adapt the model code.
Show answer & explanation

Correct answer: C. Build a custom Docker image with the framework and dependencies, then use it as a SageMaker inference container.

When a model uses a custom framework or specific dependencies not covered by SageMaker's pre-built containers, the most robust solution is to build a custom Docker image. This image can include the entire environment (OS, custom framework, libraries, inference code) needed for the model to run, which is then used as a SageMaker inference container.

Why the other options are wrong

  • A. SageMaker Neo optimizes and compiles models for specific hardware, but it still requires the model to be in a supported framework format, which a 'custom deep learning framework' might not be. It also doesn't solve the dependency packaging issue for the custom framework.
  • B. Deploying on EC2 instances would require manual infrastructure management, losing the benefits of SageMaker's managed services for deployment, scaling, and monitoring.
  • D. SageMaker built-in algorithm containers are for specific, pre-trained algorithms or common frameworks; they cannot support a 'custom deep learning framework' directly.

Custom SageMaker Inference Container

A Docker image created by a user to package custom ML frameworks, libraries, and inference code for deployment on SageMaker endpoints.

  • Enables deployment of models with unique dependencies
  • Provides full control over the inference environment
  • Must adhere to SageMaker's container contract (e.g., HTTP server)
  • Allows using any programming language or ML framework

Memory trick: Pack your own tools, show SageMaker how to run them.

More Machine Learning Implementation and Operations questions