All Products
Search
Document Center

Platform For AI:Deploy and train models

Last Updated:Apr 03, 2024

QuickStart provides a variety of pre-trained models. You can get started with the model training and deployment features of Platform for AI (PAI) by using the pre-trained models. This topic describes how to find a model that meets your business requirements, deploy and debug a model, and fine-tune a model in QuickStart.

Prerequisites

An Object Storage Service (OSS) bucket is created if you want to fine-tune or incrementally train a model. For more information, see Create buckets.

Billing

QuickStart is free to use. However, you are charged for Elastic Algorithm Service (EAS) and Deep Learning Containers (DLC) if you use QuickStart to deploy and train models. For more information, see Billing of EAS and Billing of general computing resources.

Note

You can use public resources to deploy and train models.

Find a model that is suitable for your business

QuickStart provides a variety of models to meet your business requirements in actual scenarios. You can find a model that is suitable for your business based on the following rules:

  • Search for a model based on the area and task of your business.

  • Most models provide information about the pre-training datasets. The more relevant a pre-training dataset is to your scenario, the better the results of direct deployment and fine-tuning are. You can obtain more information about the pre-training dataset on the details page of a model.

  • In general, a model with a larger number of parameters performs better, but the fees charged for using the model service and the volume of data required to fine-tune the model are higher.

To find a model that is suitable for your business, perform the following steps:

  1. Go to the QuickStart page.

    1. Log on to the Machine Learning Platform for AI (PAI) console.

    2. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the workspace that you want to manage and click the name of the workspace. The Workspace Details page appears.

    3. In the left-side navigation pane of the Workspace Details page, click QuickStart.

  2. Find a model that is suitable for your business.

    • On the QuickStart page, click a category in the All Scenarios section. In the model list that is displayed on the right, find the model that you want to use based on the model descriptions.

      image

    • Enter keywords in the search box on the QuickStart page to search for the model that you want to use.

      image

    • Go to the details page of a model, as shown in the following figure. Check the details of the model, such as the basic information, training data format, and model performance, and determine whether the model is suitable for your business.

      image

After you find the suitable model, you can directly deploy the model, debug the model online, and evaluate the inference results of the model. For more information, see the Deploy and debug a model section of this topic.

Deploy and debug a model

After you find the suitable model, you can click the model to go to the details page of the model. Then, you can deploy and debug the model. In this example, the beit-base-patch16-224-pt22k-ft22k_image-classification model in the image-classification category is used.

Directly deploy a model as a model service

  1. On the details page of the model, click Deploy in the upper-right corner.

    image

  2. Optional. Configure the model service and resource information.

    QuickStart provides preset configurations of the model service and resource information for each model based on the characteristics of the model. You can use the default configurations or modify the configurations based on your business requirements.

    Parameter

    Description

    Service Name

    The name of the model service. You can use the default service name or change the name by following the on-screen instructions. The service name must be unique in a region.

    Resource Group Type

    The type of the resource group that is used to deploy the model service. You can use a public resource group or a dedicated resource group.

    Resource Configuration

    The configurations of the resources that are used to deploy the model service. You can use the default instance type or select another instance type based on your business requirements. If you want to select another instance type, we recommend that you select an instance type whose computing power is higher than that of the default instance type. Otherwise, the model may fail to be deployed due to insufficient performance of the resources.

    image

  3. In the Deploy panel, click Deploy. In the Billing Notification message, click OK.

    The details page of the service appears. On the Service details tab, you can view the basic Information and resource Information about the service. The service is deployed after it enters the In operation state.

Debug a model service online

In the Online Prediction section of the Service details tab, enter the request data and click Send Request. Then, evaluate the inference results of the model.

image

You can construct request data based on the data format described in the model details. For some models, such as Stable Diffusion V1.5, you can click View Web App in the Web Application section to access the web UI of the model service. This allows you to perform inference and evaluate the inference results in a more convenient manner.

If the dataset that is used to pre-train the model does not completely match your business scenario, the inference results may not be as expected. In this case, you can fine-tune the model. For more information, see the Fine-tune a model section of this topic.

Fine-tune a model

To fine-tune a pre-trained model by using your own dataset, perform the following steps:

  1. On the details page of the model, click Fine-tune in the upper-right corner.

    image

  2. In the Fine-tune panel, configure the parameters that are described in the following table.

    Note

    Parameters that can be configured vary based on the models. The actual parameters that are displayed prevail.

    Section

    Parameter

    Description

    Job Configuration

    Task name

    The name of the job. You can use the default job name or change the name by following the on-screen instructions.

    Output Path

    The path of the OSS bucket in which the generated model files are stored.

    Note

    If you have configured a storage path on the details page of the workspace, the storage path is automatically used as the output path. For more information about how to configure a storage path for a workspace, see Manage workspaces.

    Maximum running time

    The maximum duration of the job. The job stops and the result is returned if the duration of the job exceeds the value of this parameter.

    By default, the duration of the job is not limited.

    Dataset Configuration

    Training dataset

    The dataset that is used for training. If you do not want to use the default dataset provided by QuickStart, prepare a dataset based on the data format described in the model details and perform one of the following operations:

    • Select OSS file or directory from the Training dataset drop-down list.

      Click the image..png icon and select the OSS bucket in which the dataset is stored. In the Select OSS directory or file dialog box, select an existing file or perform the following operations to upload a local file:

      1. Click Upload File.

      2. Click View local files or Drag file here to upload a local file as prompted.

    • Select Data Selection from the Training dataset drop-down list.

      Select a dataset from the drop-down list. If no dataset is available, click New dataset to create a dataset. For more information about how to configure the parameters of a dataset, see Create and manage datasets.

    Validate dataset

    Click Add validation dataset. The configuration method of the validation dataset is the same as that of the training dataset.

    Computing resources

    Instance Count

    The number of nodes to create based on the current image and specifications.

    Node configuration

    The specifications of the nodes. For more information about the specifications and fees, see Billing of general computing resources.

    Hyper-parameters

    Hyperparameters vary based on the models. You can use the default values or modify the parameters based on your business requirements.

  3. Click Fine-tune. In the Billing Notification message, click OK.

    The details page of the job appears. On the details page of the job, you can view the basic information, real-time status, logs, and evaluation results of the training job. The evaluation methods may vary based on the models.

After the training job is complete, you can perform the following operations:

  • In the Model Deployment section of the Task details tab, click Deploy to deploy the model. The process of deploying a fine-tuned model is the same as that of directly deploying a model. For more information, see the Deploy and debug a model section of this topic.

  • Incrementally train the model on the Task details tab. For more information, see the Incrementally train a model section of this topic.

Incrementally train a model

Incremental training uses a new dataset to further train a model that is generated after fine-tuning.

  • Benefits

    Incremental training can extend the capabilities of a model. For example, you can perform incremental training for a specific scenario if the existing results of a model are not ideal. You can also perform incremental training to make a model more compatible with new trends and changes. Compared with fine-tuning a model all over, incremental training is more cost-effective.

  • Procedure

    In the Incremental training section of the Task details tab, click Fine-tune to perform incremental training. The process of incremental training is the same as that of fine-tuning. For more information, see the Fine-tune a model section of this topic.