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, see Appendix: Roles and permissions.
Create a code build
Go to the code builds page.
Log on to the PAI console.
In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.
In the left-side navigation pane, choose to go to the code builds page.
On the Code Configuration page, click Create Code Build.
On the Create Code Build page, configure the following parameters.
Parameter
Description
Name
The name of the code build.
Description
The description of the code build. You can use descriptions to differentiate code builds.
Visibility
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.
Token
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/.
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
Log on to GitHub with your account.
Go to the GitHub Developer setting page.
On the Personal access tokens page, click Generate new token in the upper-right part.
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.
Click Generate Token to generate a token.
The following figure shows the generated token.