首页 > 解决方案 > 将 BigQuery 中生成的 AutoML 模型部署到 AI Platform 时出现问题

问题描述

我无法将使用 BigQuery 创建的 AutoML 模型部署到 AI Platform 以进行在线预测。

我通过 SQL 使用标准过程在 BigQuery 中创建了一个 AutoML 模型:

CREATE OR REPLACE MODEL `model_name`
OPTIONS
  (model_type='automl_regressor', budget_hours=2.0,
    ... ) AS
SELECT ...)

这工作正常,我能够成功获得预测结果。我现在想将其部署为在线预测。为此,我通过Export ModelBigQuery Cloud Console 中的函数将模型导出到 GCS 存储桶。这为我提供了存储桶中的目录,其中包含以下内容:

assets/
saved_model.pb
variables/

然后,我转到 AI Platform 控制台并创建了一个模型,然后使用以下预构建的容器设置为该模型创建了一个版本:

我已将存储桶的 Cloud Storage 路径设置为包含我上面列出的内容的目录,并继续为我的模型创建版本。这样做后,我会在一段时间后收到此错误:

Create Version failed. Bad model detected with error: "Failed to load model: Loading servable: {name: default version: 1} failed: Not found: Op type not registered 'DecodeProtoSparseV2' in binary running on localhost. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.\n\n (Error code: 0)"

有点难过,因为我认为这是我可以利用 BigQuery 生成的 ML 模型的方式。这里的步骤有什么问题吗?目前甚至可以部署这样的模型进行在线预测吗?如果没有,有没有办法可以转换模型以便部署?任何帮助,将不胜感激!

标签: tensorflowgoogle-cloud-platformgoogle-bigquerygoogle-cloud-automlgoogle-ai-platform

解决方案


您还可以使用此处的文档使用 AutoML 容器/Docker 部署在 BigQuery 中训练的 AutoML 模型。这类似于您如何导出和部署使用 AutoML Tables 直接训练的模型。


推荐阅读