在 Google Cloud 中进行设置

为帮助您开始使用 Vertex AI,本页面将指导您如何创建 Google Cloud 项目并启用 Vertex AI API。如果您没有执行这些任务的权限,请让管理员为您设置项目并启用 Vertex AI。本页面还介绍了如何在本地开发环境中设置 Google Cloud CLI。

设置项目

请按照以下步骤设置项目:

  1. 登录您的 Google Cloud 账号。如果您是 Google Cloud 新手,请创建一个账号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
  2. 在 Google Cloud Console 中的项目选择器页面上,选择或创建一个 Google Cloud 项目

    转到“项目选择器”

  3. 确保您的 Google Cloud 项目已启用结算功能

  4. 启用 Vertex AI API。

    启用 API

  5. 安装 Google Cloud CLI。
  6. 如需初始化 gcloud CLI,请运行以下命令:

    gcloud init
  7. 更新并安装 gcloud 组件:
    gcloud components update
    gcloud components install beta
  8. 在 Google Cloud Console 中的项目选择器页面上,选择或创建一个 Google Cloud 项目

    转到“项目选择器”

  9. 确保您的 Google Cloud 项目已启用结算功能

  10. 启用 Vertex AI API。

    启用 API

  11. 安装 Google Cloud CLI。
  12. 如需初始化 gcloud CLI,请运行以下命令:

    gcloud init
  13. 更新并安装 gcloud 组件:
    gcloud components update
    gcloud components install beta

启用 Vertex AI API

  1. 在 Google Cloud 控制台中,确保您的项目名称显示在 Google Cloud 控制台的顶部。如果未显示,请点击选择项目以打开项目选择器,然后选择您的预期项目。
  2. 如果您不在 Google Cloud 控制台的 Vertex AI 部分中,请执行以下操作:
    1. 搜索中输入 Vertex AI,然后按 Return 键。
    2. 在搜索结果中,点击 Vertex AI
      系统会显示 Vertex AI 信息中心。
  3. 点击 Vertex AI 信息中心内的启用所有推荐的 API
    启用所有推荐的 API
    启用过程可能需要一些时间才能完成。启用 API 后,Google Cloud 控制台的右上角会出现一个蓝色环形图标。

安装 Google Cloud CLI

  1. 如需激活 Google Cloud 服务并访问 gsutil 等实用工具(可将文件转移到 Cloud Storage 以及从 Cloud Storage 转移文件),请安装 Google Cloud CLI。
  2. 如需初始化 gcloud CLI,请从命令提示符运行以下命令:
    gcloud init
  3. 如需更新和安装 Beta 版 Google Cloud CLI 组件,请运行以下命令:
    gcloud components update
    gcloud components install beta

让管理员为您设置 Vertex AI 项目

本部分介绍了管理员如何授予使用 Vertex AI 所需的角色。

  1. 确定有意义的项目名称和项目 ID,以标识您的项目。如果您属于某个组织或计划创建多个项目,请考虑需遵循或可以遵循哪些命名惯例和文件夹层次结构,以使项目组织清晰。
  2. 所需的角色:
    1. 大多数 Vertex AI 功能的访问权限由 Vertex AI User (roles/aiplatform.user) IAM 角色授予,并且应足以满足大多数 Vertex AI 用户的需求。如需完全控制 Vertex AI 资源,您可以请求 Vertex AI Administrator (roles/aiplatform.admin) 角色。如需了解这些角色与其他 Vertex AI 角色之间的区别,请参阅使用 IAM 进行 Vertex AI 访问权限控制
    2. 如果您还打算在 Google Cloud 中使用 Vertex AI Workbench 笔记本,请让您的管理员为您授予项目的 Notebooks Administrator (roles/notebooks.admin) IAM 角色,以及项目或 Compute Engine 默认服务账号Service Account User (roles/iam.serviceAccountUser) IAM 角色。
    3. 此外,如需启用必要的 API,您需要 Service Usage Admin (roles/serviceusage.serviceUsageAdmin) IAM 角色,或者您的管理员需要按照前几个步骤为您启用 API。
  3. 让您的管理员为您启用 Vertex AI API。如果您已获得 Service Usage Admin (roles/serviceusage.serviceUsageAdmin) IAM 角色,则将能够按照启用 Vertex AI API 部分自行执行此操作。

后续步骤