首页 > 解决方案 > 来自标准 JSON 文件的 gcloud ai 平台预测错误:gcloud 崩溃(AttributeError):“NoneType”对象没有属性“框架”

问题描述

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

!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实验室“使用 Tensorflow 和 AI 平台预测房价”。tensorflow所有命令都在使用框架的 GCP 上的 Jupyter 笔记本中。我错过了一些东西。任何帮助表示赞赏。

标签: tensorflowgoogle-cloud-platformgcloudgcp-ai-platform-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]

推荐阅读