ML in Production: AWS SageMaker (An Introduction)
With SageMaker, we just need to make an API call using a Python SDK. SageMaker will launch ECS instances, run model training, persist the training artifacts to S3, and then shut down the EC2 instances automatically. In deployment, another API call creates EC2 instances and networking rules to access the model over the internet.
SageMaker is AWS’s fully managed service for building and deploying machine learning models in production. Developers can use SageMaker to
- label and prepare data,
- choose an algorithm,
- train, tune and optimize models, and
- deploy them to the cloud on scale.
It comprises several AWS services bundled together through an API that coordinates the creation and management of different ML resources and artifacts.
With SageMaker, we make an API call using a Python SDK, which makes it launch EC2 instances, run model training, persist the training artifacts to S3, and then shut down the EC2 instances automatically.
For deployment, another API call creates EC2 instances and networking rules to access the model over the internet.
Let’s have a look at various components of what make SageMaker.
2. DOCKER IMAGES
If we use SageMaker’s built-in ML models, we do not have to interact with Docker at all. But we need to build and publish Docker images when we develop and deploy our own custom ML models.
For a Docker image to be compatible with SageMaker, the image needs to define several environment variables, create a particular directory structure, and contain the model training and inference logic in expected locations. When SageMaker trains a model, it creates several files in the container’s /opt/ml directory.