如果您计划使用 Python 版 Vertex AI SDK,请确保初始化客户端的服务账号具有 Vertex AI Service Agent (roles/aiplatform.serviceAgent
) IAM 角色。
本教程包含多个页面:
设置项目。
每个页面均假定您已经按照本教程中之前页面的说明操作。
设置您的项目和环境
在本教程中,请使用 Google Cloud Console 与 Google Cloud 进行交互。在使用 Vertex AI 功能之前,完成以下步骤。
-
In the Google Cloud console, go to the project selector page.
-
Select or create a Google Cloud project.
- 打开 Cloud Shell。Cloud Shell 是 Google Cloud 的交互式 Shell 环境,可让您通过网络浏览器管理项目和资源。 转到 Cloud Shell
- 在 Cloud Shell 中,将当前项目设置为您的 Google Cloud 项目 ID,并将其存储在
projectid
shell 变量中:gcloud config set project PROJECT_ID && projectid=PROJECT_ID && echo $projectid
将 PROJECT_ID 替换为项目 ID。您可以在 Google Cloud 控制台中找到项目 ID。如需了解详情,请参阅查找项目 ID -
Enable the IAM, Compute Engine, Notebooks, Cloud Storage, and Vertex AI APIs:
gcloud services enable iam.googleapis.com
compute.googleapis.com notebooks.googleapis.com storage.googleapis.com aiplatform.googleapis.com -
向您的 Google 账号授予角色。对以下每个 IAM 角色运行以下命令一次:
roles/aiplatform.user, roles/storage.admin
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:EMAIL_ADDRESS" --role=ROLE
- 将
PROJECT_ID
替换为您的项目 ID。 - 将
EMAIL_ADDRESS
替换为您的电子邮件地址。 - 将
ROLE
替换为每个角色。
Vertex AI User ( - 将
roles/aiplatform.user
) IAM
角色提供使用 Vertex AI 中所有资源的权限。借助 Storage Admin (roles/storage.admin
) 角色,您可以将文档的训练数据集存储在 Cloud Storage 中。
后续步骤
按照本教程的下一页,使用 Google Cloud 控制台创建视频分类数据集。