Working with custom images

Create a custom Docker image with libraries and packages that are required for your deployments, then use the custom image to deploy your Watson Machine Learning assets.

You can build custom images based on deployment runtime images available in IBM Watson Machine Learning. The images contain preselected open source libraries and selected IBM libraries. By building custom images, you can optimize the standard software configuration of a runtime for your application needs. You can also use custom images in air-gapped environments with requirements that forbid to expose any operations to the internet.

Note: The way that you create a custom image depends on whether you are building an image for Python-based models and functions or an SPSS image. For details, refer to Creating a custom image.

Notes:

These custom image types are not compatible with 4.5.0 or later releases of Cloud Pak for Data:

If your custom image belongs to one of these categories, you must rebuild your image. Use the new base images published in the current release.

Rebuilding an existing image

  1. Download the latest base image.
  2. Rebuild the image with required libraries.
  3. Upload the rebuilt image to local Cloud Pak for Data registry.
  4. Update the existing runtime-definition file with the new image.
  5. Perform online or batch scoring on the existing deployment.

Note: If your deployed model uses a custom image that was created in one of previous releases of Cloud Pak for Data, you don't have to create a fresh deployment.

Training the model

If you want to train your SPSS model that uses a custom image, you can start with Building custom images to install ODBC drivers.

If you want to train your Python models or functions that use a custom image, you can start with Creating and training with custom image for Watson Studio. The Watson Studio image cannot be used for deployment in Watson Machine Learning, though. For deployment, create a custom image for Watson Machine Learning, as described in Creating a Watson Machine Learning custom image.

Supported frameworks for custom images

This table lists frameworks that are supported by the latest runtime image (wml-deployment-runtime-py39-1).

Framework Versions Online Batch
Scikit-learn 1.0 Yes Yes
XGBoost 1.5 Yes Yes
TensorFlow 2.7 Yes Yes
PyTorch 1.10 Yes Yes
Python function 0.1 Yes Programmatic only
Inline payload only
Python scripts 1.0 No Yes

This table lists the supported frameworks for the SPSS base image under wml-deployment-runtime-spss-server.json:

Framework Versions Online Batch
SPSS 18.2 No Yes

Creating and registering a custom image

Required role: You must be a Cloud Pak for Data cluster administrator to create and register a custom image.

Follow these steps to create and register a custom image:

  1. Preparing to build a new image
  2. Adding customizations and building a new image
  3. Pushing the image to the container server
  4. Changing and uploading the configuration file

Using the image for deployments

To use the custom image, follow these steps:

  1. Save the trained model that you want to deploy with the custom image to Watson Machine Learning
  2. Deploy the model

This sample Python notebook shows how to use the custom image to deploy a Python function.

Additional considerations

If you use custom images, you must consider the following aspects:

Parent topic: Deploying and managing models