简体   繁体   English

在 Google Cloud Vertex AI 上部署客户处理程序

[英]Deployment with customer handler on Google Cloud Vertex AI

I'm trying to deploy a TorchServe instance on Google Vertex AI platform but as per their documentation ( https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#response_requirements ), it requires the responses to be of the following shape:我正在尝试在 Google Vertex AI 平台上部署一个 TorchServe 实例,但根据他们的文档( https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#response_requirements ),它需要响应具有以下形状:

{
  "predictions": PREDICTIONS
}

Where PREDICTIONS is an array of JSON values representing the predictions that your container has generated.其中PREDICTIONS是一个包含 JSON 个值的数组,表示您的容器生成的预测。

Unfortunately, when I try to return such a shape in the postprocess() method of my custom handler, as such:不幸的是,当我尝试在自定义处理程序的postprocess()方法中返回这样的形状时,如下所示:

def postprocess(self, data):
    return {
        "predictions": data
    }

TorchServe returns: TorchServe 返回:

{
  "code": 503,
  "type": "InternalServerException",
  "message": "Invalid model predict output"
}

Please note that data is a list of lists, for example: [[1, 2, 1], [2, 3, 3]].请注意, data是列表的列表,例如:[[1, 2, 1], [2, 3, 3]]。 (Basically, I am generating embeddings from sentences) (基本上,我是从句子生成嵌入)

Now if I simply return data (and not a Python dictionary), it works with TorchServe but when I deploy the container on Vertex AI, it returns the following error: ModelNotFoundException .现在,如果我只是返回data (而不是 Python 字典),它可以与 TorchServe 一起使用,但是当我在 Vertex AI 上部署容器时,它会返回以下错误: ModelNotFoundException I assumed Vertex AI throws this error since the return shape does not match what's expected (cf documentation).我假设 Vertex AI 抛出此错误,因为返回形状与预期不匹配(参见文档)。

Did anybody successfully manage to deploy a TorchServe instance with custom handler on Vertex AI?有人成功地在 Vertex AI 上部署了带有自定义处理程序的 TorchServe 实例吗?

Actually, making sure that the TorchServe processes correctly the input dictionary (instances) solved the issue.实际上,确保 TorchServe 正确处理输入字典(实例)解决了这个问题。 It seems like what's on the article did not work for me. 文章中的内容似乎对我不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谷歌云顶点 AI 工作台笔记本卡在“启动” - Google cloud vertex AI workbench notebook stuck on "starting" Vertex AI 自定义容器部署 - Vertex AI Custom Container deployment Google Cloud Platform - 使用自定义数据格式进行 Vertex AI 训练 - Google Cloud Platform - Vertex AI training with custom data format 从 Vertex AI 和谷歌云存储读取文件 - Reading File from Vertex AI and Google Cloud Storage 在 Vertex AI(谷歌云平台)中使用 model 进行预测 - Using model for prediction in Vertex AI (Google Cloud Platform) 从 Google AI Platform / Vertex AI 中的本地 Jupyter 和笔记本访问 Google Cloud Storage - Accessing Google Cloud Storage from local Jupyter and Notebooks in Google AI Platform / Vertex AI 顶点ai中的自定义容器部署 - Custom Container deployment in vertex ai 在 Google Cloud Vertex AI 中为具有单标签图像的数据集创建导入文件 - Create import file for a dataset with single-label images in Google Cloud Vertex AI 我如何在谷歌云平台上跟踪顶点 ai 自定义作业的成本 - how do I track the cost of a vertex ai custom job on google cloud platform 为 Vertex AI model 评估生成实例和预测模式文件(谷歌云管道组件) - Generate instances and prediction schema files for Vertex AI model evaluation (Google Cloud pipeline components)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM