All Products
Document Center

Machine Learning Platform for AI:Code builds

Last Updated:Jul 19, 2023

When you submit a model training job, you may need to compile the code that you customized for the job. Machine Learning Platform for AI (PAI) allows you to create code builds. Code builds are public AI assets that you can reference in different jobs. This topic describes how to create a code build.

Account and permission requirements

  • Alibaba Cloud account: You can use an Alibaba Cloud account to complete all operations without additional authorization.

  • RAM user: You need to add a RAM user as a workspace member of certain roles and assign permissions to the roles. For more information, go to the Roles and Permissions page. image.png

Create a code build

  1. Go to the code builds page.

    1. Log on to the PAI console.

    2. In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.

    3. In the left-side navigation pane, choose AI Computing Asset Management > Source Code Repositories to go to the code builds page.

  2. On the Code Builds page, click Create Code Build.

  3. On the Create Code Build page, configure the following parameters.




    The name of the code build.


    The description of the code build. You can use descriptions to differentiate code builds.


    The visible scale of the code build. Valid values:

    • Private: The code build is visible only to you and the administrators in the current workspace.

    • Public: The code build is visible to all users in the current workspace.

    Git Repository Address

    The address of the Git repository where the code build is stored.

    Code branch

    The branch of the Git repository. The default value is master.

    Code Commit

    The priority of commits is higher than branches. If you specify this parameter, the Code branch parameter does not take effect.

    Git Username

    You must specify this parameter if the Git repository that you specified is private.


    You must specify this parameter if the Git repository that you specified is private. For more information about how to obtain a GitHub account token, see Obtain a GitHub account token.

    Local Directory

    The directory of the source code file. The default value is /root/code/.

  4. Click Submit.

Manage code builds

After you create a code build, you can modify the visible scale of the code build or delete the code build.管理代码集

Obtain a GitHub account token

  1. Log on to GitHub with your account.

  2. Go to the GitHub Developer setting page.

  3. On the Personal access tokens page, click Generate new token in the upper-right part.

  4. Enter a token name into the text box below Note and select access options in the Select scopes section. We recommend that you select all access options.配置Token信息

  5. Click Generate Token to generate a token.

    The following figure shows the generated token.生成的Token