我能够生成本地预测,但不能用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 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 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}]}
发布于 2020-10-07 18:31:15
在培训vs预测环境中,您可能有不同版本的xgboost。
发布于 2021-09-14 14:38:01
我遇到了一个类似的问题,@mshearer0 0在我的例子中是正确的----它是一个版本不匹配的。显然,密切关注用于培训模型和部署模型的运行时版本的确切版本是非常重要的,因为错误消息传递非常缺乏信息(如本例)。
若要查看每个运行时的版本列表,请参阅此GCP文件链接。
对我来说,我不得不卸载,然后重新安装与运行时版本相匹配的正确版本。
pip uninstall xgboost
pip install xgboost==1.4.0
对于运行时版本2.5。
https://stackoverflow.com/questions/63876392
复制相似问题