Hello 表格型資料:設定專案和環境

本教學課程將逐步說明必要步驟,協助您在 Google Cloud 控制台中訓練表格資料模型並取得預測結果。如果您打算使用 Vertex AI SDK for Python,請確認初始化用戶端的服務帳戶具備 Vertex AI 服務代理程式 (roles/aiplatform.serviceAgent) IAM 角色。

在本教學課程的這一部分,您將設定 Google Cloud 專案,以使用 Vertex AI 和 Cloud Storage bucket,其中包含用於訓練 AutoML 模型的檔案。

設定專案和環境

  1. In the Google Cloud console, go to the project selector page.

    Go to project selector

  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.
  3. Verify that billing is enabled for your Google Cloud project.

  4. 開啟 Cloud Shell。 Cloud Shell 是一種互動式殼層環境,可讓您透過網路瀏覽器管理專案和資源。 Google Cloud
  5. 前往 Cloud Shell
  6. 在 Cloud Shell 中,將目前的專案設為專案 ID,並儲存在 Google Cloudprojectid 殼層變數中:
      gcloud config set project PROJECT_ID &&
      projectid=PROJECT_ID &&
      echo $projectid
    PROJECT_ID 替換為專案 ID。您可以在 Google Cloud 控制台中找到專案 ID。詳情請參閱「找出專案 ID」。
  7. Enable the IAM, Compute Engine, Notebooks, Cloud Storage, and Vertex AI APIs:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable iam.googleapis.com  compute.googleapis.com notebooks.googleapis.com storage.googleapis.com aiplatform.googleapis.com
  8. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/aiplatform.user, roles/storage.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

    • PROJECT_ID: Your project ID.
    • USER_IDENTIFIER: The identifier for your user account. For example, myemail@example.com.
    • ROLE: The IAM role that you grant to your user account.
  9. 「Vertex AI 使用者」IAM 角色 (roles/aiplatform.user) 可存取 Vertex AI 中的所有資源。儲存空間管理員 (roles/storage.admin) 角色可讓您將文件的訓練資料集儲存在 Cloud Storage 中。

    後續步驟

    請按照本教學課程的下一頁,建立表格型資料集並訓練分類模型。