Playground 採用預先部署的 Vertex AI 線上預測端點,不會產生費用。開啟支援模型的模型資訊卡後,即可使用「試用」面板傳送文字提示,快速測試模型功能。您也可以設定幾個最常見的參數,例如溫度和輸出符記數量。Playground 僅支援輸入和輸出文字。
啟動 Spaces 後,您會獲得可運作的網路應用程式,與部署模型及建構應用程式來使用模型端點相比,手動作業量大幅減少。Model Garden 會在 Vertex AI 中部署所選模型,並在 Cloud Run 執行個體上部署範例應用程式,該執行個體會使用已部署模型的端點。應用程式也可以使用現有端點或 MaaS 端點。
如要啟動模型,請開啟支援模型的模型資訊卡,然後在「試用 Spaces」面板中,按一下要啟動的 Space。您需要為部署作業使用的機器,以及代管應用程式的 Cloud Run 執行個體付費。
事前準備
本教學課程需要設定 Google Cloud 專案,並啟用 Vertex AI API。
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. 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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. 在 Google Cloud 控制台中,前往支援模型的模型資訊卡,例如 Gemma 2 模型資訊卡。
在「Try out」(試試看!)面板中:
- 在「Region」(區域) 部分,接受預設值或選擇您的區域。
- 在「Endpoint」部分,選取「Demo playground」。
- 在「提示」方塊中輸入
Why is the sky blue?
。 - 展開「進階選項」部分,查看預設參數。
按一下「提交」。輸出內容會顯示在「提交」按鈕下方。
- BLIP 圖片說明文字
- BLIP VQA
- BLIP2
- Flux
- Gemma 2
- Gemma 3
- Gemini 2.5 Flash
- Gemini 2.5 Pro
- Instant ID
- Llama 3.2
- Llama 3.3
- Llama 4
- Llama 3.2 90B
- Llama 4 Maverick 17B-128E
- LLaVA 1.5 和 LLaVA-NeXT
- Mistral 自行代管 (7B 和 Nemo)
- PaliGemma 1 和 2
- Phi-3
- Phi-4
- Qwen2
- Stable Diffusion Inpainting
- Stable Diffusion v2.1
- Stable Diffusion XL LCM
- Stable Diffusion XL Lightning
- Stable Diffusion XL
- DeepSeek R1 (0528)
- Cloud Run Admin API (
run.googleapis.com
) - Artifact Registry API (
artifactregistry.googleapis.com
) - Cloud Build API (
cloudbuild.googleapis.com
) - Cloud Logging API (
logging.googleapis.com
) -
Vertex AI 服務專員
(
roles/aiplatform.serviceAgent
) -
Cloud Build 服務帳戶
(
roles/cloudbuild.builds.builder
) storage.buckets.create
run.services.create
artifactregistry.repositories.create
run.services.setIamPolicy
前往 Google Cloud 控制台的 Model Garden,查看模型的模型資訊卡。
選取要使用的模型。支援的模型會顯示「試用 Spaces」面板,例如 Gemma 3 模型資訊卡。
按一下「rocket_launch」rocket_launch「執行」,即可啟動 Space。
- 您可以選擇「需要驗證」 (透過 Identity Aware Proxy) 或「允許公開存取」。詳情請參閱「啟用首次部署作業的 API 並授予權限」。
- 按一下「建立新服務」即可開始部署。您可以在模型資訊卡中監控部署狀態。
當「空間」狀態變更為「就緒」後,請按一下該空間,查看部署詳細資料。
如要取得基本防護,網頁應用程式需要密鑰,提交提示時必須將密鑰附加至網址。這個密鑰會顯示在「密鑰」欄位中。
- 按一下「開啟」即可開始使用應用程式。您可以在應用程式中傳送提示給模型,並查看模型的回覆。
你可以分享網址,讓其他人也能試用應用程式。
- 如要關閉應用程式的存取權,請按一下「存取權控管」欄位中的「編輯」 。
在 Cloud Run 應用程式的「安全性」分頁中,選取「需要驗證」,然後按一下「儲存」。該應用程式已無法透過網址存取。造訪該網址會導致 403 錯誤 (禁止)。
在 Google Cloud 控制台中,查看 Cloud Run 服務清單:
找出要刪除的服務,然後選取該服務。
按一下「刪除」。這會刪除服務的所有修訂版本。
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
試用 Playground
試用 Spaces
您可以透過 Gemini、Gemma、Llama 和 Stable Diffusion 等模型啟動 Space。以下列出支援的項目範例:
IAM 權限
除了使用 Vertex AI 的現有權限外,您還必須具備下列權限才能啟動 Spaces:
動作 | 所需權限 | 目的 |
---|---|---|
啟用更多 API | serviceusage.services.enable |
啟用下列 API:
|
將權限授予服務帳戶 | resourcemanager.projects.setIamPolicy |
將下列角色授予
Compute Engine 預設服務帳戶: |
部署特定權限 |
|
部署期間,系統會將一組原始碼上傳至 Cloud Storage,然後部署至 Cloud Run,並建立新的服務。您必須提供 artifactregistry.repositories.create ,才能建立容器映像檔的存放區。您必須run.services.setIamPolicy ,才能公開存取服務。 |
如果您是專案擁有者,則不需採取其他行動,只要按照 Vertex AI Studio 中的指南操作即可。如果您不是專案擁有者,請要求專案管理員執行前兩項動作,然後授予您「編輯者」 (roles/editor
) 和「Cloud Run 管理員」 (roles/run.admin
) 角色。
啟動 Spaces
啟動 Spaces,測試及實驗範例 Gradio 應用程式中的模型。
清除所用資源
如要避免系統向您的 Google Cloud 帳戶收取本頁所用資源的費用,請按照下列步驟操作。
刪除聊天室
如要清除 Spaces,您必須刪除模型資源和 Cloud Run 上的範例應用程式資源。
刪除模型資源
您可以在 Gradio 應用程式中刪除模型端點,藉此清除 Vertex AI 資源。接著,您需要刪除 Cloud Run 服務,才能停止並刪除 Gradio 應用程式。
如要手動刪除 Vertex AI 資源,請參閱「取消部署模型並刪除資源」。
刪除 Cloud Run 服務
刪除與服務相關的資源,包括服務的所有修訂版本。刪除服務不會一併刪除 Artifact Registry 中的容器映像檔等項目。 詳情請參閱 Cloud Run 說明文件中的「管理服務」。
刪除專案
如要避免付費,最簡單的方法就是刪除您為了本教學課程所建立的專案。
如要刪除專案:
後續步驟
請參閱 Model Garden 總覽。