【问题标题】:Deployment with customer handler on Google Cloud Vertex AI在 Google Cloud Vertex AI 上使用客户处理程序进行部署
【发布时间】:2021-11-21 04:48:24
【问题描述】:

我正在尝试在 Google Vertex AI 平台上部署一个 TorchServe 实例,但根据他们的文档 (https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#response_requirements),它要求响应具有以下形状:

{
  "predictions": PREDICTIONS
}

其中 PREDICTIONS 是一个 JSON 值数组,表示您的容器生成的预测。

不幸的是,当我尝试在自定义处理程序的postprocess() 方法中返回这样的形状时,如下所示:

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

TorchServe 返回:

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

请注意data 是一个列表列表,例如:[[1, 2, 1], [2, 3, 3]]。 (基本上,我是从句子中生成嵌入)

现在,如果我只是返回 data(而不是 Python 字典),它可以与 TorchServe 一起使用,但是当我在 Vertex AI 上部署容器时,它会返回以下错误:ModelNotFoundException。我假设 Vertex AI 会抛出此错误,因为返回形状与预期不匹配(参见文档)。

是否有人成功地在 Vertex AI 上部署了带有自定义处理程序的 TorchServe 实例?

【问题讨论】:

  • 什么意思:data 是一个列表列表?你能添加例子吗?
  • 我刚刚添加了一个例子!

标签: google-cloud-platform pytorch google-cloud-ml google-cloud-vertex-ai torchserve


【解决方案1】:

实际上,确保 TorchServe 正确处理输入字典(实例)解决了这个问题。 article 上的内容似乎对我不起作用。

【讨论】:

    猜你喜欢
    • 2023-02-05
    • 2021-11-06
    • 2022-11-10
    • 2022-11-11
    • 2021-12-03
    • 1970-01-01
    • 2020-01-15
    • 2022-01-25
    • 2023-01-26
    相关资源
    最近更新 更多