Working with custom images

Create a custom Docker image with libraries and packages 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 pre-selected open-source libraries, as well as selected IBM libraries. Building custom images enables you to optimize the standard software configuration of a runtime for your application needs. Custom images can also be used in air-gapped environments with requirements which forbid exposing any operations to the Internet.

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

Notes:

Training the model

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

If you want to train your Python models or functions using 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, you will need to 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 supported with latest custom images (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 frameworks supported with deprecated custom images (wml-deployment-runtime-py37-2 and wml-deployment-runtime-py38-1).

Framework Versions Online Batch
Scikit-learn 0.23 Yes Yes
XGBoost 1.3 Yes Yes
TensorFlow 2.4 Yes Yes
PyTorch 1.7 Yes Yes
Python function 0.1 Yes Programmatic only
Inline payload only
Python scripts 1.0 No Yes

Here are the supported frameworks for the SPSS base image under wml-deployment-runtime-spss-server.json:

Framework Versions Online Batch
Scikit-learn 18.2 No Yes

Creating a Watson Machine Learning custom image

These are the high-level steps for creating a custom image for Watson Machine Learning and making it available for deployments.

Required role: You must be an admin of the Cloud Pak for Data instance to download a runtime definition and register a runtime definition for a new image. You must have root privileges on your machine to execute the commands that build a custom image.

Prerequisite: Download the base image for the runtime image that you want to customize. Refer to Downloading the base image.

Prepare to build a new image:

  1. SPSS only: Get the registry URL to use for Docker commands and in scripts. The SPSS Modeler runtime images are stored in a Docker image registry. In Cloud Pak for Data, you can only use an external registry outside of the Cloud Pak for Data OpenShift cluster. To use that registry, you need the URL to the external registry that was used during the installation of Cloud Pak for Data. You use the same URL for all commands and in all scripts that you run.
  2. SPSS only: Download the configuration file for the SPSS Deployment runtime image that you want to customize. Refer to Downloading the configuration file for SPSS.
  3. SPSS and Python: Download the image.

Follow these steps to create and register a custom image:

  1. Add customizations, build a new image, and push the image to the container registry. For details, refer to Creating and uploading a custom image.
  2. Create a new base software specification for the custom image, base_sw_spec, that will be surfaced for deploying assets.
  3. Create the new runtime definition file for the custom image, which maps the base_sw_spec to the custom_image.

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 the 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: Managing frameworks and software specifications