首页 > 解决方案 > GCP AI 平台上 TensorFlow 模型的输入格式

问题描述

我已将模型上传到 GCP AI Platform Models。这是一个简单的 Keras 多步模型,具有 5 个在 168 个滞后值上训练的特征。当我尝试在其中测试模型时,我收到了这个奇怪的错误消息:

  "error": "Prediction failed: Error during model execution: <_MultiThreadedRendezvous of RPC that terminated with:\n\tstatus = StatusCode.FAILED_PRECONDITION\n\tdetails = \"Error while reading resource variable dense_7/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/dense_7/bias)\n\t [[{{node model_2/dense_7/BiasAdd/ReadVariableOp}}]]\"\n\tdebug_error_string = \"{\"created\":\"@1618946146.138507164\",\"description\":\"Error received from peer ipv4:127.0.0.1:8081\",\"file\":\"src/core/lib/surface/call.cc\",\"file_line\":1061,\"grpc_message\":\"Error while reading resource variable dense_7/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/dense_7/bias)\\n\\t [[{{node model_2/dense_7/BiasAdd/ReadVariableOp}}]]\",\"grpc_status\":9}\"\n>"

输入采用以下格式,列表 ((1, 168, 5))

请参见下面的示例:

{
"instances": 
[[[ 3.10978284e-01,  2.94650396e-01,  8.83664149e-01,
          1.60210423e+00, -1.47402699e+00],
        [ 3.10978284e-01,  2.94650396e-01,  5.23466315e-01,
          1.60210423e+00, -1.47402699e+00],
        [ 8.68576328e-01,  7.78699823e-01,  2.83334426e-01,
          1.60210423e+00, -1.47402699e+00]]]
} 

标签: python-3.xtensorflowkerasgoogle-cloud-platformgcp-ai-platform-training

解决方案


推荐阅读