Updated on 2023-09-06 GMT+08:00

Using Existing Algorithms to Train Models

You can quickly use a created algorithm to create a training job and build a model.

Prerequisites

  • Data has been prepared. Specifically, you have created an available dataset in ModelArts, or you have uploaded the dataset used for training to the OBS directory.
  • The algorithm used for training is available on the Algorithm Management page. The algorithm can be obtained by creating a custom script . The newly created algorithms are supported only in the new version of training management. For details, see Creating an Algorithm.
  • At least one empty folder has been created in OBS for storing the training output.
  • The account is not in arrears because resources are consumed when training jobs are running.
  • The OBS directory you use and ModelArts are in the same region.

Precautions

In the dataset directory specified for a training job, the names of the files (such as the image file, audio file, and label file) containing data used for training contain 0 to 255 characters. If the names of certain files in the dataset directory contain over 255 characters, the training job will ignore these files and use data in the valid files for training. If the names of all files in the dataset directory contain over 255 characters, no data is available for the training job and the training job fails.

Creating a Training Job

  1. Log in to the ModelArts management console. In the left navigation pane, choose Training Management > Training Jobs. By default, the system switches to the Training Jobs page.
  2. In the upper left corner of the training job list, click Create to switch to the Create Training Job page.
  3. Set related parameters and click Next.
    1. Enter the basic information, including Name and Description. For Version, the system automatically creates a version number, which is named according to a certain rule, for example, V0001 and V0002. The version number cannot be changed.
    2. Set job parameters, including the data source, algorithm source, and more. For details, see Table 1. The value range of the data source is consistent with the constraints of existing algorithms.
      Table 1 Job parameters

      Parameter

      Sub-Parameter

      Description

      Algorithm Source

      Algorithm Management

      Select Algorithm Management and click Select on the right of the algorithm name. The Algorithm Management page is displayed.

      • On the My Algorithms tab page, you can select a created algorithm. The newly created algorithms are supported only in the new version of training management. For details, see Creating an Algorithm.

      Training Input

      Data Source > Dataset

      Select an available dataset and its version from the ModelArts Data Management module.

      • Dataset: Select a published dataset from the drop-down list. If no dataset is available in ModelArts, no result will be displayed in the drop-down list.
      • Version: Select a version based on the selected dataset.

      Data Source > Data path

      Select the training data from your OBS bucket. On the right of the Data path text box, click Select. In the dialog box that is displayed, select an OBS folder for storing data.

      Training Output

      Model Output

      Select the storage path of the training result (OBS path). To minimize errors, select an empty directory for Model Output. Do not use the dataset storage directory as the training output location.

      Hyperparameters

      -

      The value of this parameter varies according to the selected algorithm.

      If tuning parameters are defined for the created or subscribed algorithm, you need to set the parameters when you create a training job. You can click Add Hyperparameter to add multiple hyperparameters.

      Job Log Path

      -

      Select a path for storing log files generated during job running.

    3. Select resources for the training job. The value range of the training parameters is consistent with the constraints of existing algorithms.
      Table 2 Resource parameters

      Parameter

      Description

      Resource Pool

      Select resource pools for the job. For training jobs, Public resource pools and Dedicated resource pools are available.

      Instance Flavor

      Select a resource flavor based on the resource type. The GPU resource delivers better performance, and the CPU resource is more cost effective. If your algorithm has been defined to use CPUs or GPUs, you can select a proper resource flavor based on the constraints of existing algorithms. Invalid options are grayed out.

      The data disk capacity varies depending on the resource type. For details, see What Are Sizes of the /cache Directories for GPU and CPU Resources in the Training Environment?

      Compute Nodes

      Set the number of compute nodes. The default value is 1.

    4. Configure the subscription function and set whether to save the parameter settings of the training job.
      Figure 1 Configuring notifications for the training job
      Table 3 Parameters related to the subscription function and parameter configuration saving

      Parameter

      Description

      Notification

      Select the resource pool status to be monitored from the event list, and SMN sends a notification message when the event occurs.

      This parameter is optional. You can choose whether to enable subscription based on actual requirements. If you enable subscription, set the following parameters as required:

      • Topic: indicates the topic name. You can create a topic on the SMN console.
      • Event: indicates the event to be subscribed to. The options are OnJobRunning, OnJobSucceeded, and OnJobFailed, indicating that the job is in progress, successful, and failed, respectively.

      Saving Training Parameters

      If you select this option, the parameter settings of the current training job will be saved to facilitate subsequent job creation.

      Select Save Training Parameters and specify Configuration Name and Description. After a training job is created, you can switch to the Job Parameters tab page to view your saved job parameter settings. For details, see Managing Job Parameters.

    5. After setting the parameters, click Next.
  4. On the Confirm page that is displayed, confirm that the information is correct and click Submit. Generally, training jobs run for a period of time, which may be several minutes or tens of minutes depending on the amount of your selected data and resources.

    After a training job is created, it is started immediately. During the running, you will be charged based on your selected resources.

    You can switch to the training job list to view the basic information about training jobs. In the training job list, Status of the newly created training job is Initializing. If the status changes to Successful, the training job ends and the model generated is stored in the location specified by Training Output Path. If the status of a training job changes to Running failed. Click the name of the training job and view the job logs. Troubleshoot the fault based on the logs.