Instructions for Developing Personalized AI Images with oneAPI and Docker in AWS SageMaker
To deploy a custom inference and training solution using daal4py with AWS SageMaker, you generally need to follow these steps:
- Prepare your ML code with daal4py
- Create a Dockerfile that installs daal4py and dependencies, copies your code, and sets up SageMaker serving.
- Build and push the container to AWS Elastic Container Registry (ECR).
- Use the container image in SageMaker for training and hosting (inference).
High-Level Steps
1. Prepare your ML code with daal4py
- Write training and inference scripts that use daal4py.
- Follow SageMaker's training and serving container conventions:
- Training entry point script (e.g., )
- Inference script or a script with a predictive function (e.g., or a script that implements , , , )
2. Create a Dockerfile
- Install daal4py and dependencies.
- Copy your code into the container.
- Set up SageMaker serving (e.g., using or SageMaker Python SDK serving interface).
- Support training (entry-point script).
3. Build and push container to AWS ECR
Detailed Steps including sample Dockerfile
Step 1: Prepare your training and inference code
Example :
```python
```
Example implementing SageMaker serving interface:
```python
```
Step 2: Create Dockerfile
```Dockerfile
```
Step 3: Build and Push image to AWS ECR
Follow the AWS documentation to authenticate Docker to ECR, create an ECR repository, build the Docker image, tag it, and push it to ECR.
Step 4: Use the image in SageMaker
In your SageMaker training or inference job, specify the image URI:
```python
```
Summary
- The Dockerfile installs daal4py and dependencies, copies training and inference scripts, and defines SageMaker serving entrypoint.
- Build & push the container to ECR, and reference the image in SageMaker estimator and model serving.
- This provides a self-contained workflow to run custom daal4py models on SageMaker with your own Docker images.
This tutorial assumes the use of SageMaker models and endpoints. For more information, refer to the SageMaker XGBoost container Repo and the Intel Cloud Optimization Module for SageMaker - XGBoost.
Data-and-cloud-computing technology plays a significant role in this workflow, as daal4py, a machine learning (ML) library, is used to prepare the ML code for AWS SageMaker. The Dockerfile, a key technology component, is created to install daal4py and its dependencies, copy the ML code, and set up SageMaker serving. This configuration allows for training and hosting (inference) of custom daal4py solutions using AWS SageMaker.