agent-platform-tuning
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Platform Model Tuning
Agent Platform模型调优
Overview
概述
This skill provides procedural knowledge for fine-tuning Large Language Models
(both Open Models and Gemini Models) using Agent Platform's tuning service. It
covers the entire lifecycle from environment setup and data preparation to job
configuration, monitoring, and deployment.
本技能提供了使用Agent Platform调优服务对大语言模型(包括开源模型和Gemini模型)进行微调的流程知识。涵盖了从环境搭建、数据准备到任务配置、监控和部署的完整生命周期。
Workflow Decision Tree
工作流决策树
-
Model Category Identification: Has the user explicitly stated whether they want to tune an Open Model or a Gemini Model?
- No → STOP. Ask the user if they want to tune an Open Model or a Gemini Model. CRITICAL EXCEPTION for Environment Setup Requests: If the user is specifically asking for environment setup instructions (e.g. "What environment setup is needed?"), you MUST provide the full Phase 0 environment setup instructions in your initial response, simultaneously with asking clarifying questions about the model category.
- If the user provides a specific tuning purpose, you should
recommend three models: one Open Model, one Gemini Model, and a third
generally recommended choice. Briefly list the pros and cons of each
(e.g., Gemini models might be more expensive, etc.). CRITICAL: You
must read during this step and only recommend models explicitly listed in that catalog. Do not recommend unsupported models like Mistral. Do not proceed with model configuration until the category is confirmed.
references/models.md - Yes → Proceed.
-
Environment Check: Has the environment (Auth, APIs, IAM, Venv) been initialized?
- No → Go to Phase 0: Environment & IAM Setup.
- Yes → Proceed.
-
Dataset Status: Is the dataset ready in JSONL format, is its structure valid for tuning, and is it uploaded to Google Cloud Storage?
- **No** → Go to [Phase 1: Dataset Preparation & Upload](#phase-1). - **Yes** → Proceed. -
Column Selection Confirmation: Have you presented the columns to the user and confirmed the mapping?
- No → STOP. You must show samples and get user confirmation on column mapping as described in Phase 1.0 before proceeding.
- Yes → Proceed.
-
Configuration: Has the user provided the target model and hyperparameters, or explicitly agreed to your recommendations?
- No → Go to Phase 2: Model Configuration & Recommendation.
- Yes → Proceed.
-
Job Status: Has the tuning job been submitted?
- **No** → Go to [Phase 3: Tuning Job Execution](#phase-3-tuning-job-execution). - **Yes** → Proceed. -
Job Completion: Is the tuning job complete?
- **No** → Go to [Phase 4: Monitoring](#phase-4-monitoring). - **Yes** → Proceed. -
Deployment: Has the tuned model been deployed (if required)?
- **No** → Go to [Phase 5: Model Deployment](#phase-5-model-deployment). - **Yes** → Task Complete.
-
模型类别识别:用户是否明确说明要调优开源模型还是Gemini模型?
- 否 → 停止。询问用户是要调优开源模型还是Gemini模型。环境搭建请求的关键例外情况:如果用户明确询问环境搭建说明(例如“需要进行哪些环境搭建?”),您必须在初始回复中提供完整的第0阶段:环境与IAM搭建说明,同时询问关于模型类别的澄清问题。
- 如果用户提供了具体的调优用途,您应该推荐三个模型:一个开源模型、一个Gemini模型,以及一个通用推荐模型。简要列出每个模型的优缺点(例如,Gemini模型可能成本更高等)。关键要求:此步骤中您必须查阅,仅推荐该目录中明确列出的模型。请勿推荐不受支持的模型,如Mistral。在确认模型类别之前,请勿继续进行模型配置。
references/models.md - 是 → 继续。
-
环境检查:环境(身份验证、API、IAM、虚拟环境)是否已初始化?
- 否 → 进入第0阶段:环境与IAM搭建。
- 是 → 继续。
-
数据集状态:数据集是否已准备为JSONL格式,结构是否符合调优要求,并且已上传至Google Cloud Storage?
- **否** → 进入[第1阶段:数据集准备与上传](#phase-1)。 - **是** → 继续。 -
列选择确认:您是否已向用户展示列信息并确认映射关系?
- 否 → 停止。在继续之前,您必须按照第1.0阶段的说明展示样本并获得用户对列映射的确认。
- 是 → 继续。
-
配置确认:用户是否已提供目标模型和超参数,或明确同意您的推荐?
- 否 → 进入第2阶段:模型配置与推荐。
- 是 → 继续。
-
任务状态:调优任务是否已提交?
- **否** → 进入[第3阶段:调优任务执行](#phase-3-tuning-job-execution)。 - **是** → 继续。 -
任务完成情况:调优任务是否已完成?
- **否** → 进入[第4阶段:监控](#phase-4-monitoring)。 - **是** → 继续。 -
部署情况:调优后的模型是否已部署(如需要)?
- **否** → 进入[第5阶段:模型部署](#phase-5-model-deployment)。 - **是** → 任务完成。
Phase 0: Environment & IAM Setup {#phase-0}
第0阶段:环境与IAM搭建 {#phase-0}
Ensure the foundational environment is ready before proceeding.
在继续之前,确保基础环境已准备就绪。
0.1 Authentication & Project Context
0.1 身份验证与项目上下文
- Check if CLI is installed. If it is not installed, prompt the user for permission to install it before proceeding. If it is installed, update it:
gcloud
bash
gcloud components update --quiet > /dev/null 2>&1- Verify . If not authenticated, run
gcloud auth list.gcloud auth login - Ensure and
projectare known. Uselocationto retrieve the current project (andgcloud config get projectfor region).gcloud config get compute/region - CRITICAL: Ask for Confirmation. You must prompt the user to confirm the retrieved project and region before proceeding, in case they want to switch to a different one.
- 检查是否已安装CLI。如果未安装,在继续之前请先征求用户的安装许可。如果已安装,请进行更新:
gcloud
bash
gcloud components update --quiet > /dev/null 2>&1- 验证。如果未通过身份验证,运行
gcloud auth list。gcloud auth login - 确保已知和
project。使用location获取当前项目(使用gcloud config get project获取区域)。gcloud config get compute/region - 关键要求:请求确认。您必须提示用户确认获取到的项目和区域,以防他们想要切换到其他项目或区域。
0.2 Possible Locations
0.2 可用区域
The following locations are available for tuning:
- us-central1
- europe-west4
- us-west1
- us-east5
- asia-southeast1
No other values are supported for this section, ensure that the location is
listed above.
以下区域支持调优:
- us-central1
- europe-west4
- us-west1
- us-east5
- asia-southeast1
此部分不支持其他值,请确保区域在上述列表中。
0.3 Enable APIs
0.3 启用API
Ensure and are enabled.
aiplatform.googleapis.comstorage.googleapis.combash
gcloud services enable aiplatform.googleapis.com storage.googleapis.com \
--project=YOUR_PROJECT确保已启用和。
aiplatform.googleapis.comstorage.googleapis.combash
gcloud services enable aiplatform.googleapis.com storage.googleapis.com \
--project=YOUR_PROJECT0.4 IAM Permissions
0.4 IAM权限
Verify the following identities have the required roles.
- Agent Platform Service Agent:
service-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com - Managed OSS Fine Tuning Service Agent:
service-PROJECT_NUMBER@gcp-sa-vertex-moss-ft.iam.gserviceaccount.com - User Identity: The account running the commands.
验证以下身份是否具备所需角色。
- Agent Platform服务代理:
service-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.com - 托管OSS微调服务代理:
service-PROJECT_NUMBER@gcp-sa-vertex-moss-ft.iam.gserviceaccount.com - 用户身份:运行命令的账户。
0.5 Virtual Environment
0.5 虚拟环境
Create and use a virtual environment named in the home
directory. Install dependencies from .
tuning_agent_venvreferences/requirements.txtbash
python3 -m venv ~/tuning_agent_venv
source ~/tuning_agent_venv/bin/activate
pip install -r references/requirements.txtCRITICAL AGENT INSTRUCTION: You MUST ensure that every Python command or
script execution (e.g., , ) is prefixed
with the virtual environment activation command: .
Additionally, advise the user that every single time they run a Python command,
execute a script, or inspect data inline, they MUST also activate this
virtual environment first in their bash execution. For example:
.
Do not run standalone commands without activating the environment, as
they will encounter issues.
python3 scripts/...pip install ...source ~/tuning_agent_venv/bin/activate &&source ~/tuning_agent_venv/bin/activate && python3 ...python3ModuleNotFoundError在主目录中创建并使用名为的虚拟环境。从安装依赖项。
tuning_agent_venvreferences/requirements.txtbash
python3 -m venv ~/tuning_agent_venv
source ~/tuning_agent_venv/bin/activate
pip install -r references/requirements.txtAgent关键指令:您必须确保每个Python命令或脚本执行(例如、)都以虚拟环境激活命令为前缀:。此外,建议用户每次运行Python命令、执行脚本或内联检查数据时,都必须先在bash环境中激活此虚拟环境。例如:。请勿在未激活环境的情况下运行独立的命令,否则会遇到问题。
python3 scripts/...pip install ...source ~/tuning_agent_venv/bin/activate &&source ~/tuning_agent_venv/bin/activate && python3 ...python3ModuleNotFoundErrorPhase 1: Dataset Preparation & Upload {#phase-1}
第1阶段:数据集准备与上传 {#phase-1}
1.0 Dataset Discovery & Confirmation
1.0 数据集发现与确认
- User-Provided Dataset Verification: If the user specifies a dataset
filename or path in their prompt, verify its existence in the workspace
(e.g. via script execution or checking for typos).
- If the file cannot be found anywhere, you MUST inform the user that the dataset file does not exist or cannot be accessed. You MUST prompt the user to provide a valid dataset path. Alternatively, if candidate dataset files are found in the workspace during your search, you MUST present the candidates to the user and ask them to select one. You MUST stop tool execution immediately after reporting the missing file or presenting candidates, and wait for the user's response. Do NOT ask for 80/20 validation split permission, and do NOT attempt to upload the dataset before receiving a valid dataset file selection from the user.
- If the file is found and verified, proceed to Step 1.1 Formatting & Validation below.
- Auto-Discovery: From User Bucket: If the user does not have a dataset
and no suitable alternative is found in the Hugging Face reference, offer to
search the user's GCS buckets for potential training data. Prioritize
searching for files with extensions like ,
.jsonl,.json, and.csv. If such files are found, read the first few lines/records of each to determine if they contain text-based data suitable for tuning (e.g., prompt/completion pairs) that can be modified to follow Data Preparation Guide and is related to the tuning task requested. DO NOT search without prompting first..parquet - Auto-Discovery: From Task to Huggingface: If the user has a specific
task, refer to Huggingface Datasets Reference
and recommend a dataset from this if one exists. For each dataset
recommended, provide some information about the dataset and provide some
reasonable splits. > [!IMPORTANT] > CRITICAL: Ask for Confirmation and
Column Selection. Do not proceed > with dataset preparation or upload
until you perform the following > steps and get user confirmation: > 1.
Dataset and Split Confirmation: Present the dataset and > available
splits to the user and have them confirm which to use. > 2. Column
Selection (Hugging Face or Custom Datasets): You must: > - Provide a list
of all available columns in the selected dataset > split. > - Show a few
samples from the dataset to help the user > understand the content and
make the choice of columns. > - Recommend which columns should be mapped to
(or user > message) and
prompt(or assistant response), offering a few > reasonable options if applicable. > - Ask the user to confirm the column mapping or specify which > columns to use.completion
- 用户提供的数据集验证:如果用户在提示中指定了数据集文件名或路径,请验证其是否存在于工作区中(例如通过脚本执行或检查拼写错误)。
- 如果文件无处可寻:您必须告知用户数据集文件不存在或无法访问。您必须提示用户提供有效的数据集路径。或者,如果在搜索工作区时发现候选数据集文件,您必须将候选文件展示给用户并让他们选择一个。报告文件缺失或展示候选文件后,您必须立即停止工具执行,等待用户回复。请勿请求80/20验证拆分权限,也请勿在收到用户选择的有效数据集文件之前尝试上传数据集。
- 如果文件已找到并验证:继续进行下方的1.1格式化与验证步骤。
- 自动发现:从用户存储桶:如果用户没有数据集,且在Hugging Face参考中未找到合适的替代方案,可提议搜索用户的GCS存储桶以寻找潜在的训练数据。优先搜索扩展名为、
.jsonl、.json和.csv的文件。如果找到此类文件,读取每个文件的前几行/记录,判断其是否包含适合调优的文本数据(例如提示/完成对),且可修改为符合数据准备指南的格式,并与请求的调优任务相关。请勿在未先提示的情况下进行搜索。.parquet - 自动发现:从任务到Hugging Face:如果用户有特定任务,请参考Hugging Face数据集参考,如果存在合适的数据集则进行推荐。对于每个推荐的数据集,提供一些关于数据集的信息以及合理的拆分方式。> [!IMPORTANT] > 关键要求:请求确认与列选择。在进行数据集准备或上传之前,您必须执行以下步骤并获得用户确认:> 1. 数据集与拆分确认:向用户展示数据集和可用的拆分方式,让他们确认使用哪一种。> 2. 列选择(Hugging Face或自定义数据集):您必须:> - 提供所选数据集拆分中的所有可用列列表。> - 展示数据集中的一些样本,帮助用户理解内容并选择列。> - 建议哪些列应映射到(或用户消息)和
prompt(或助手回复),如有适用提供几个合理的选项。> - 请求用户确认列映射或指定使用哪些列。completion
1.1 Formatting & Validation
1.1 格式化与验证
- Conversion: If data is in CSV, JSON, or Parquet, use
to convert.
scripts/prepare_dataset.py - Validation Split Confirmation: If the user only provides a training
dataset, you must prompt the user to seek permission to split the
training dataset 80/20 to form a validation dataset (using
). If they agree, proceed with the split. If they decline, just use the training dataset without a validation dataset.
--validation_split 0.2 - Validation: If data is already in JSONL, validate it before uploading.
Simply having a extension is not enough. You must verify that the content schema is valid for tuning (e.g. correct system/user/model roles).
.jsonl
bash
python3 scripts/prepare_dataset.py \
--input my_data.jsonl \
--format <messages|messages_gemini> \
--validate_only(Use for open models and for
Gemini models.) - Refer to Data Preparation Guide
for required schemas.
--format messages--format messages_gemini- 转换:如果数据为CSV、JSON或Parquet格式,使用进行转换。
scripts/prepare_dataset.py - 验证拆分确认:如果用户仅提供训练数据集,您必须提示用户,请求将训练数据集按80/20拆分以形成验证数据集的权限(使用)。如果用户同意,继续进行拆分。如果用户拒绝,仅使用训练数据集而不创建验证数据集。
--validation_split 0.2 - 验证:如果数据已为JSONL格式,在上传前进行验证。仅拥有扩展名是不够的,您必须验证内容架构是否符合调优要求(例如正确的系统/用户/模型角色)。
.jsonl
bash
python3 scripts/prepare_dataset.py \
--input my_data.jsonl \
--format <messages|messages_gemini> \
--validate_only(开源模型使用,Gemini模型使用)- 参考数据准备指南了解所需架构。
--format messages--format messages_gemini1.2 Upload
1.2 上传
Upload formatted files to GCS using a unique directory (e.g., with a
datetime timestamp) to avoid overwriting outputs from different runs.
<!-- disableFinding(LINE_OVER_80) --> `bash
.jsonlARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_<datetime>/dataset.jsonl" gcloud
storage cp dataset.jsonl $ARTIFACTS` <!-- enableFinding(LINE_OVER_80) -->
将格式化后的文件上传至GCS,使用唯一目录(例如包含时间戳)以避免覆盖不同运行的输出。<!-- disableFinding(LINE_OVER_80) --> <!-- enableFinding(LINE_OVER_80) -->
.jsonlbash ARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_<datetime>/dataset.jsonl" gcloud storage cp dataset.jsonl $ARTIFACTSPhase 2: Model Configuration & Recommendation {#phase-2}
第2阶段:模型配置与推荐 {#phase-2}
Help the user choose the best model and parameters. Always seek user
confirmation before submitting the job.
- If the user does not specify a specific model in their prompt, calculate recommendations based on the Models Catalog.
- Prompt for Confirmation: Present the recommended model to the user and ask for their confirmation before configuring hyperparameters.
帮助用户选择最佳模型和参数。提交任务前务必征求用户确认。
- 如果用户在提示中未指定特定模型,请根据模型目录计算推荐方案。
- 请求确认:向用户展示推荐的模型,在配置超参数前请求他们的确认。
2.1 Configuration
2.1 配置
For Open Models
针对开源模型
- Recommend ,
tuning_mode,epochs, andlearning_ratebased on the Tuning Guide and model-specific baselines in the Models Catalog.adapter_size
- 根据调优指南和模型目录中的模型特定基线,推荐、
tuning_mode、epochs和learning_rate。adapter_size
2.2 Calculating Cost (Open Models Only)
2.2 成本计算(仅开源模型)
- We can calculate a rough estimate of cost of tuning based on the dataset and
the selected model in the Models Catalog:
bash
python3 scripts/calculate_cost.py \ --input my_data.jsonl \ --model MODEL_NAME \ --tuning_mode TUNING_MODE \ --epochs epochs
[!NOTE] Handling Missing Dataset Errors: Iffails because the dataset file (e.g.scripts/calculate_cost.pyormy_data.jsonl) cannot be found, you MUST inform the user that the dataset file does not exist or cannot be accessed. You MUST prompt the user to provide a valid dataset path, and stop tool execution immediately to wait for their response. Do NOT retry or loop, do NOT invent a specific cost number, and do NOT prompt for job submission approval before receiving a valid dataset from the user.dummy_data.jsonl
- Prompt for Confirmation: Present the recommended hyperparameter configuration and estimated cost to the user and ask for their approval before proceeding to job submission. Make sure to note that the estimated cost is just an estimate and can vary from actual billing costs.
- 我们可以根据数据集和所选模型,参考模型目录粗略计算调优成本:
bash
python3 scripts/calculate_cost.py \ --input my_data.jsonl \ --model MODEL_NAME \ --tuning_mode TUNING_MODE \ --epochs epochs
[!NOTE] 处理数据集缺失错误:如果因无法找到数据集文件(例如scripts/calculate_cost.py或my_data.jsonl)而失败,您必须告知用户数据集文件不存在或无法访问。您必须提示用户提供有效的数据集路径,并立即停止工具执行以等待用户回复。请勿重试或循环,请勿编造具体成本数值,也请勿在收到用户提供的有效数据集前请求任务提交批准。dummy_data.jsonl
- 请求确认:向用户展示推荐的超参数配置和估算成本,在继续进行任务提交前请求他们的批准。请务必注明估算成本仅为近似值,实际账单成本可能有所不同。
Phase 3: Tuning Job Execution {#phase-3-tuning-job-execution}
第3阶段:调优任务执行 {#phase-3-tuning-job-execution}
CRITICAL Pre-Flight Check (GCS Verification): Before you propose a
confirmation prompt or submit any tuning job, you MUST verify that the
specified training dataset GCS URI (e.g. or
) actually exists and is accessible. Run
(or ).
gs://dummy_bucket/dataset.jsonlgs://YOUR_BUCKET/...gcloud storage ls $DATASET_URIgsutil ls- If the verification fails (e.g. ,
BucketNotFound,404, or indicating a dummy/missing bucket), you MUST inform the user that the GCS bucket or dataset does not exist or cannot be accessed. You MUST prompt the user to provide a valid GCS URI for the dataset, and stop tool execution immediately to wait for their response. Do NOT propose a confirmation prompt and do NOT execute any tuning scripts before receiving a valid dataset URI from the user.AccessDenied - If the verification succeeds, proceed to propose the confirmation prompt below.
关键预检查(GCS验证):在提出确认提示或提交任何调优任务之前,您必须验证指定的训练数据集GCS URI(例如或)是否实际存在且可访问。运行(或)。
gs://dummy_bucket/dataset.jsonlgs://YOUR_BUCKET/...gcloud storage ls $DATASET_URIgsutil ls- 如果验证失败(例如、
BucketNotFound、404,或表明存储桶为虚拟/缺失):您必须告知用户GCS存储桶或数据集不存在或无法访问。您必须提示用户提供有效的数据集GCS URI,并立即停止工具执行以等待用户回复。请勿提出确认提示,也请勿在收到用户提供的有效数据集URI前执行任何调优脚本。AccessDenied - 如果验证成功:继续提出下方的确认提示。
For Gemini Models
针对Gemini模型
Check if exists.
scripts/tune_gemini_model.py-
Ifexists: Submit the Gemini model tuning job using this script.
scripts/tune_gemini_model.pybashpython3 scripts/tune_gemini_model.py -
Ifdoes not exist: Instruct the user to manually configure and submit the tuning job via the Google Cloud Console UI or using the Agent Platform SDK for Python.
scripts/tune_gemini_model.py
检查是否存在。
scripts/tune_gemini_model.py-
如果存在:使用此脚本提交Gemini模型调优任务。
scripts/tune_gemini_model.pybashpython3 scripts/tune_gemini_model.py -
如果不存在:指导用户通过Google Cloud Console UI或使用Agent Platform Python SDK手动配置并提交调优任务。
scripts/tune_gemini_model.py
For Open Models
针对开源模型
Submit the open model tuning job using . Identify
the model id using available models documentation at
<!-- disableFinding(LINE_OVER_80) -->
<!-- enableFinding(LINE_OVER_80) -->
scripts/tune_open_model.pybash
python3 scripts/tune_open_model.py \
--project YOUR_PROJECT \
--location YOUR_LOCATION \
--base_model BASE_MODEL_ID \
--train_dataset gs://YOUR_BUCKET/tuning_agent_job_<datetime>/dataset.jsonl \
--output_uri gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output \
--epochs EPOCHS \
--learning_rate LR \
--tuning_mode MODE[!IMPORTANT] Interactive Confirmation Required (Tier M): Before proceeding with job submission, you MUST present the proposed command string showing all literal flags in a confirmation prompt to the user with 'Yes' and 'No' options.
CRITICAL: When presenting this confirmation prompt to the user, you MUST output it as a direct plain text response and stop tool execution immediately. Do NOT call any command execution or interactive tools in the same turn, as unexpected tool calls may be auto-replied by the simulation harness and cause an infinite loop. Yield immediately for the user's reply.
使用提交开源模型调优任务。参考可用模型文档<!-- disableFinding(LINE_OVER_80) -->
文档识别模型ID。
<!-- enableFinding(LINE_OVER_80) -->
scripts/tune_open_model.pybash
python3 scripts/tune_open_model.py \
--project YOUR_PROJECT \
--location YOUR_LOCATION \
--base_model BASE_MODEL_ID \
--train_dataset gs://YOUR_BUCKET/tuning_agent_job_<datetime>/dataset.jsonl \
--output_uri gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output \
--epochs EPOCHS \
--learning_rate LR \
--tuning_mode MODE[!IMPORTANT] 需要交互式确认(Tier M):在继续提交任务之前,您必须向用户展示包含所有字面标志的拟议命令字符串作为确认提示,并提供“是”和“否”选项。
关键要求:向用户展示此确认提示时,您必须将其输出为直接的纯文本回复,并立即停止工具执行。请勿在同一轮次中调用任何命令执行或交互式工具,因为模拟工具可能会自动回复导致无限循环。请立即等待用户回复。
Phase 4: Monitoring {#phase-4-monitoring}
第4阶段:监控 {#phase-4-monitoring}
Monitor the job via the Cloud Console link provided in the script output.
Additionally, ask the user if they want you to monitor the job status for them
in the background. If they agree, execute as
a background task to periodically poll the job status and notify the user to
show the status. If the user declines, leave it completely to the user to
check on the status.
scripts/monitor_tuning_job.py通过脚本输出中提供的Cloud Console链接监控任务。此外,询问用户是否希望您在后台监控任务状态。如果用户同意,将作为后台任务执行,定期轮询任务状态并通知用户。如果用户拒绝,则完全由用户自行检查状态。
scripts/monitor_tuning_job.pyPhase 5: Model Deployment {#phase-5-model-deployment}
第5阶段:模型部署 {#phase-5-model-deployment}
Once the tuning job is , deploy the model.
SUCCEEDEDbash
ARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output/postprocess/node-0/checkpoints/final"
gcloud ai model-garden models deploy \
--project=YOUR_PROJECT \
--region=YOUR_LOCATION \
--model="$ARTIFACTS" \
--machine-type=MACHINE_TYPE \
--accelerator-type=ACCELERATOR_TYPE \
--accelerator-count=COUNT[!IMPORTANT] Interactive Confirmation Required (Tier M): Before proceeding with deployment, you MUST present the proposed command string showing all literal flags in a confirmation prompt to the user with 'Yes' and 'No' options.
CRITICAL: When presenting this confirmation prompt to the user, you MUST output it as a direct plain text response and stop tool execution immediately. Do NOT call any command execution or interactive tools in the same turn, as unexpected tool calls may be auto-replied by the simulation harness and cause an infinite loop. Yield immediately for the user's reply.
Refer to Models Catalog for hardware recommendations for
specific open models.
调优任务显示后,部署模型。
SUCCEEDEDbash
ARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output/postprocess/node-0/checkpoints/final"
gcloud ai model-garden models deploy \
--project=YOUR_PROJECT \
--region=YOUR_LOCATION \
--model="$ARTIFACTS" \
--machine-type=MACHINE_TYPE \
--accelerator-type=ACCELERATOR_TYPE \
--accelerator-count=COUNT[!IMPORTANT] 需要交互式确认(Tier M):在继续部署之前,您必须向用户展示包含所有字面标志的拟议命令字符串作为确认提示,并提供“是”和“否”选项。
关键要求:向用户展示此确认提示时,您必须将其输出为直接的纯文本回复,并立即停止工具执行。请勿在同一轮次中调用任何命令执行或交互式工具,因为模拟工具可能会自动回复导致无限循环。请立即等待用户回复。
参考模型目录获取特定开源模型的硬件推荐。
Resources
资源
- Data Preparation Guide
- Models Catalog
- Tuning Guide
- : Data conversion & validation.
scripts/prepare_dataset.py - : Open model tuning job submission.
scripts/tune_open_model.py
- 数据准备指南
- 模型目录
- 调优指南
- :数据转换与验证。
scripts/prepare_dataset.py - :开源模型调优任务提交。
scripts/tune_open_model.py