【问题标题】:Issue deploying AutoML model generated in BigQuery to AI Platform将 BigQuery 中生成的 AutoML 模型部署到 AI Platform 时出现问题
【发布时间】:2021-05-22 02:02:05
【问题描述】:

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

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

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

这很好,我能够成功获得预测结果。我现在想将其部署为在线预测。为此,我通过 BigQuery Cloud Console 中的 Export Model 函数将模型导出到 GCS 存储桶。这给了我存储桶中的一个目录,其中包含以下内容:

assets/
saved_model.pb
variables/

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

  • Python 版本:3.7
  • 框架:TensorFlow
  • 框架版本:2.3.1
  • ML 运行时版本:2.3

我已将存储桶的 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 模型的方式。这里的步骤有什么问题吗?目前甚至有可能部署这样的模型进行在线预测吗?如果没有,有没有办法可以转换模型以便可以部署它?任何帮助将不胜感激!

【问题讨论】:

    标签: tensorflow google-cloud-platform google-bigquery google-cloud-automl google-ai-platform


    【解决方案1】:

    据我了解,您已在 BigQuery ML 中训练了一个 automl_regressor 模型,并打算将其用于通过 AI Platform 进行在线预测。但是根据documentation的说法,无法使用automl_regressor进行在线预测。

    • 模型类型 AUTOML_REGRESSOR 和 AUTOML_CLASSIFIER 的导出模型 不支持在线预测的 AI Platform 部署。

    根据您的需要,您可以从 BigQuery ML 列表here 中选择其他模型,可以部署用于在线预测。

    此外,您还可以直接使用 AutoML 训练您的模型,并将其部署并用于在线预测。虽然,请注意 AutoML 模型用于特定的预测要求,例如描述 here。另外,您需要关注documentation 来训练模型。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-12-16
        • 2023-02-09
        • 2022-07-14
        • 1970-01-01
        相关资源
        最近更新 更多