python – Google Cloud ML FAILED_PRECONDITION

我正在尝试使用Google Cloud ML来托管Tensorflow模型并获得预测.我有一个已经上传到云端的预训练模型,我在Cloud ML控制台中创建了一个模型和版本.

我按照说明from here准备我的数据以请求在线预测.对于Python方法和glcoud方法,我都得到了同样的错误.为简单起见,我将发布gcloud方法

我运行gcloud ml-engine预测–model spell_correction –json-instances test.json,其中test.json是我的输入数据文件(名为instances的JSON数组).我得到以下结果:

ERROR: (gcloud.ml-engine.predict) HTTP request Failed. Response: {
  "error": {
  "code": 400,
  "message": "Precondition check Failed.",
  "status": "Failed_PRECONDITION"
  }
}

我怎样才能获得更多这方面的细节?当我尝试使用Python时,会发生同样的错误,并且我有一个包含错误的googleapiclient.http.HttpRequest对象.我只是想知道为什么除了这个通用错误之外发生了这个错误.有谁知道如何通过Python方法或gcloud方法获取更多细节?我假设,因为它是相同的错误,它是相同的根本原因.

输出gcloud ml-engine型号列表:

NAME              DEFAULT_VERSION_NAME
spell_correction  testing

输出gcloud ml-engine版本列表–model spell_correction

NAME     DEPLOYMENT_URI
testing  gs://<my-bucket>/output/1/

test.json:{“instances”:[{“tokens”:[[9],[4],[11],[9]],“mask”:[[18],[7],[12], [30]],“keep_prob”:1.0,“beam”:64}]}

我对模型的输入:

标记:tf.placeholder(tf.int32,shape = [None,None])

mask:tf.placeholder(tf.int32,shape = [None,None])

keep_prob:tf.placeholder(tf.float32)

beam:tf.placeholder(tf.int32)

通过python调用时,request_body只是一个字符串test.json.

解决方法:

附注:您是否首先尝试使用您的模型进行“本地预测”(https://cloud.google.com/sdk/gcloud/reference/ml-engine/local/predict)?您可能首先可以获得更多信息.

相关文章

MNIST数据集可以说是深度学习的入门,但是使用模型预测单张M...
1、新建tensorflow环境(1)打开anacondaprompt,输入命令行...
这篇文章主要介绍“张量tensor是什么”,在日常操作中,相信...
tensorflow中model.fit()用法model.fit()方法用于执行训练过...
https://blog.csdn.net/To_be_little/article/details/12443...
根据身高推测体重const$=require('jquery');const...