我正尝试使用Google Cloud ML托管Tensorflow模型并获取预测结果。我有一个预先训练好的模型,我已经上传到云端,并且在我的Cloud ML控制台中创建了一个模型和版本。Google Cloud ML FAILED_PRECONDITION
我按照指示from here来准备我的数据以请求在线预测。对于Python方法和glcoud
方法,我都会得到相同的错误。为简单起见,我会发布的gcloud
方法:
我跑gcloud ml-engine predict --model spell_correction --json-instances test.json
其中test.json
是我输入的数据文件(JSON数组名为instances
)。我得到以下结果:
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 models list
:
gcloud ml-engine versions list --model spell_correction
NAME DEPLOYMENT_URI
testing gs://<my-bucket>/output/1/
test.json
NAME DEFAULT_VERSION_NAME
spell_correction testing
:{"instances": [{"tokens": [[9], [4], [11], [9]], "mask": [[18], [7], [12], [30]], "keep_prob": 1.0, "beam": 64}]}
我输入到模型:
tokens
: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
为字符串。
可以运行'gcloud毫升发动机车型list'以及'gcloud毫升引擎版本列表--model spell_correction'验证模型已成功创建? – rhaertel80
将输出添加到问题 – jbird
您可以发布在test.json中发送的内容以及通过python作为请求发送的内容? – Bhupesh