【问题标题】:Google AI Platform XGBoost - Local prediction working but online prediction not workingGoogle AI Platform XGBoost - 本地预测有效但在线预测无效
【发布时间】:2020-12-31 17:00:07
【问题描述】:

我可以使用 gcloud 生成本地预测,但不能生成 XGBoost 模型的在线预测。在线预测没有错误信息,只是一个空响应

本地预测 -
输入json - [40, 1, 0, 20, 3, 2020, 4, 0, 0, 0, 2, 0, 5, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]

gcloud-

gcloud ai-platform local predict --model-dir <model_dir> --json-instances <input_json> --framework xgboost

输出 -

INFO: Display format: "default table[no-heading](predictions)"
[0.3261602520942688]

当我使用相同的 json 生成在线预测时

在线预测
gcloud -

gcloud ai-platform predict --model $MODEL_NAME --version $VERSION_NAME --json-instances test_json_modified.json

输出 -

INFO: Display format: "default table[no-heading](predictions)"
[[]]

我尝试使用 GUI 生成在线预测,但仍然无法获得任何结果 -

我尝试过使用不同的输入 json 格式,如下所示,但没有任何效果 -

{"instances": [{"values": [[40, 1, 0, 20, 3, 2020, 4, 0, 0, 0, 2, 0, 5, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]], "key": 1}]}

【问题讨论】:

    标签: python machine-learning xgboost google-cloud-ml google-ai-platform


    【解决方案1】:

    您的训练与 Gcp 预测环境中可能有不同版本的 xgboost

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,@mshearer0 在我的情况下是正确的 -这是版本不匹配。显然,密切关注您用于训练模型的确切版本和部署模型的运行时版本非常重要,因为错误消息非常不具信息性(如本示例)。

      要查看每个运行时的版本列表,请参阅link on the GCP documentation

      对我来说,我必须卸载然后重新安装与运行时版本匹配的正确版本,例如

      pip uninstall xgboost
      pip install xgboost==1.4.0
      

      适用于运行时版本 2.5。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-12-07
        • 2020-11-21
        • 1970-01-01
        • 2016-06-02
        • 2020-06-15
        • 2017-01-09
        • 2021-07-19
        相关资源
        最近更新 更多