来自标准 JSON 文件的 gcloud ai-platform 预测错误:gcloud 崩溃AttributeError:'NoneType' 对象没有属性 'framework'

问题描述

我正在尝试对 JSON 文件 records.json 运行 ML 预测请求。

!gcloud ai-platform predict --model housing_prices --json-instances records.json

我收到以下错误

Using endpoint [https://ml.googleapis.com/]
ERROR: gcloud crashed (AttributeError): 'nonetype' object has no attribute 'framework'

导入所有库。

import pandas as pd
import tensorflow as tf

我正在关注 qwiklabs lab“使用 Tensorflow 和 AI 平台预测房价”。所有命令都在使用 tensorflow 框架的 GCP 上的 Jupyter notebook 中。我错过了一些东西。任何帮助表示赞赏。

解决方法

我设法解决了这个问题。 :) 感谢 @john-hanley 指点我检查我可能遗漏了什么。

分辨率:

  • ssh 进入虚拟机(虽然由 GCP 管理)我更新了 gcloud 组件
  • $ gcloud components update
  • 我的预测命令!gcloud ai-platform predict --model housing_prices --json-instances records.json
  • 按预期抛出输出。
Using endpoint [https://ml.googleapis.com/]
PREDICTIONS
[24958.638671875]
[19435.654296875]