我正嘗試使用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