连接到运行时
本页面介绍了如何在 Colab Enterprise 中连接到运行时。
如需在笔记本中运行代码,您必须连接到运行时。运行时是运行代码的计算资源。
准备工作
- 登录您的 Google Cloud 账号。如果您是 Google Cloud的新用户, 请创建一个账号,以评估我们的产品在 实际应用场景中的表现。新客户还可获享 $300 赠金,用于 运行、测试和部署工作负载。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform, Dataform, and Compute Engine APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
使用不同方法连接
本页面介绍了如何使用以下方法连接到运行时:
使用默认运行时
本部分介绍了如何连接到默认运行时。
所需的角色
如需获得连接到 Colab Enterprise 笔记本中的默认运行时所需的权限,请让您的管理员为您授予项目的 Colab Enterprise User (roles/aiplatform.colabEnterpriseUser) IAM 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
连接到默认运行时
当您首次在笔记本中运行代码时,Colab Enterprise 会自动连接到默认运行时,除非您 指定了其他运行时。
如需连接到默认运行时而不运行代码,请执行以下操作:
-
在 Google Cloud 控制台中,前往 Colab Enterprise 我的笔记本页面。
-
在区域菜单中,选择包含笔记本的区域。
-
点击您要打开的笔记本。如果您尚未创建笔记本,请创建一个笔记本。
-
在笔记本中,点击连接 。
-
如果这是您第一次连接到启用了最终用户凭据的运行时,系统会显示登录对话框。
如需为 Colab Enterprise 授予对用户凭据的访问权限,请完成以下步骤:
-
在登录对话框中,点击您的用户账号。
-
选择查看、修改、配置和删除您的 Google Cloud 数据...,为 Colab Enterprise 授予对用户凭证的访问权限。
-
点击继续。
-
Colab Enterprise 会连接到默认运行时。如果默认运行时未运行,Colab Enterprise 会启动默认运行时,然后连接到该运行时。
连接到现有运行时
本部分介绍了如何使用连接到 Agent Platform 运行时 对话框连接到现有运行时。
所需的角色
如需获得连接到 Colab Enterprise 笔记本中的现有运行时所需的权限,请让您的管理员为您授予项目的 Colab Enterprise User (roles/aiplatform.colabEnterpriseUser) IAM 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
连接到现有运行时
如需连接到现有运行时,请执行以下操作:-
在 Google Cloud 控制台中,前往 Colab Enterprise 我的笔记本页面。
-
在区域菜单中,选择包含笔记本的区域。
-
点击您要打开的笔记本。如果您尚未创建笔记本,请创建一个笔记本。
-
在笔记本中,点击其他连接选项 展开箭头, 然后选择连接到运行时 。
系统会打开连接到 Agent Platform 运行时 对话框。
-
对于选择运行时, 选择连接到现有运行时。
-
点击连接。
-
如果运行时启用了最终用户凭据,并且这是您第一次连接到启用了最终用户凭据的运行时,系统会显示登录对话框。
如需为 Colab Enterprise 授予对用户凭据的访问权限,请完成以下步骤:
-
在登录对话框中,点击您的用户账号。
-