GCP顶点 - 获取部署模型ID的直接方法
有没有一种方法可以直接从gcloud AI模型上传
命令中获取模型ID?
使用JSON输出或值输出,需要通过分裂和提取来操纵。如果有一种方法可以直接获取模型ID而不操纵,请告知。
output = !gcloud ai models upload \
--region=$REGION \
--display-name=$JOB_NAME \
--container-image-uri=us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest \
--artifact-uri=$GCS_URL_FOR_SAVED_MODEL \
--format="value(model)"
output
-----
['Using endpoint [https://us-central1-aiplatform.googleapis.com/]',
'projects/xxxxxxxx/locations/us-central1/models/1961937762277916672',
'Waiting for operation [8951184153827606528]...',
'...................................done.']
Is there a way to directly acquire the model ID from the gcloud ai models upload
command?
Either using JSON output or value output, need to manipulate by splitting and extracting. If there is a way to directly get the model ID without manipulation, please advise.
output = !gcloud ai models upload \
--region=$REGION \
--display-name=$JOB_NAME \
--container-image-uri=us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest \
--artifact-uri=$GCS_URL_FOR_SAVED_MODEL \
--format="value(model)"
output
-----
['Using endpoint [https://us-central1-aiplatform.googleapis.com/]',
'projects/xxxxxxxx/locations/us-central1/models/1961937762277916672',
'Waiting for operation [8951184153827606528]...',
'...................................done.']
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gcloud AI模型的输出描述$ model_name
包括DiventionedModelid。因此,如果您有model_name,请仅提取一个部署的modelid:
如果您有许多已部署的版本并且需要选择一个,则需要细化。
The output of
gcloud ai models describe $MODEL_NAME
includes the deployedModelId.So if you have the MODEL_NAME, to extract just a deployedModelId:
It will need refinement if you have many deployed versions and need to select one.
由于您已经有
$ region
和$ job_name
的值用最小操作的ID。请参阅下面的命令:
输出:
如果要形成由
gcloud AI返回的实际字符串,则可以将变量置于变量。
输出:
Since you already have values for
$REGION
and$JOB_NAME
, you can use executegcloud ai models list
after you uploaded the model to get the model id with minimal manipulation.See command below:
Output:
If you want to form the actual string returned by
gcloud ai models upload
you can just concatenate your variables.Output: