Updated on 2024-06-12 GMT+08:00

Overview

The subscribed algorithms and preset images can be used in most training scenarios. In certain scenarios, ModelArts allows you to create custom images to train models.

Customizing an image requires a deep understanding of containers. Use this method only if the subscribed algorithms and preset images cannot meet your requirements. Custom images can be used to train models in ModelArts only after they are uploaded to the Software Repository for Container (SWR).

You can use custom images for training on ModelArts in either of the following ways:

  • Using a preset image with customization

    If you need to modify or add some software dependencies based on the preset image, you can customize the preset image. In this case, select a preset image and choose Customize from the version drop-down list.

  • Using a custom image

    You can create an image based on the ModelArts image specifications, select your own image and configure the code directory (optional) and boot command to create a training job.

Using a Preset Image with Customization

The only difference between this method and creating a training job totally based on a preset image is that you must select an image. You must create a custom image based on a preset image. For details about how to customize a preset image, see Using a Base Image to Create a Training Image.

Figure 1 Creating an algorithm using a preset image with customization

The process of this method is the same as that of creating a training job based on a preset image. For example:

  • The system automatically injects environment variables.
    • PATH=${PATH}:${MA_HOME}/anaconda/bin
    • LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MA_HOME}/anaconda/lib
    • PYTHONPATH=${PYTHONPATH}:${MA_JOB_DIR}
  • The selected boot file will be automatically started using Python commands. Ensure that the Python environment is correct. You can run the following commands to check the Python version used by the training job:
    • export MA_HOME=/home/ma-user; docker run --rm {image} ${MA_HOME}/anaconda/bin/python -V
    • docker run --rm {image} $(which python) -V
  • The system automatically adds hyperparameters associated with the preset image.

Using a Custom Image

Figure 2 Creating an algorithm using a custom image

For details about how to use custom images supported by new-version training, see Specifications for Custom Images for Training Jobs.