gcloud 本地预测有效,但在线预测失败 "NodeDef mentions attr 'output_type' not in Op"
glcoud local predict works, but online predict fails with "NodeDef mentions attr 'output_type' not in Op"
我在本地使用 TensorFlow 训练了一个模型并将其上传到 Google Cloud ML Engine。尽管 gcloud ml-engine local predict
的本地测试工作正常,但使用 gcloud ml-engine predict
的在线预测失败并出现此错误:
{
"error": "Prediction failed: Error during model execution: AbortionError(code=StatusCode.INVALID_ARGUMENT, details=\"NodeDef mentions attr 'output_type' not in Op output:int64; attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, DT_UINT16, DT_INT16, DT_INT8, DT_COMPLEX64, DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT32, DT_HALF]; attr=Tidx:type,default=DT_INT32,allowed=[DT_INT32, DT_INT64]>; NodeDef: dnn/head/predictions/class_ids = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, _output_shapes=[[-1]], output_type=DT_INT64, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](dnn/head/logits, dnn/head/predictions/class_ids/dimension)\n\t [[Node: dnn/head/predictions/class_ids = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, _output_shapes=[[-1]], output_type=DT_INT64, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](dnn/head/logits, dnn/head/predictions/class_ids/dimension)]]\")"
}
问题是不同版本的 TensorFlow:1.4.1 在我的本地机器上,我用它来训练,1.2 在 Google 云上。使用 CLI 工具时可以指定版本,但不能指定 Google 云 Web 控制台,因此解决方案是使用 gcloud ml-engine versions create
和 --runtime-version=1.4
参数。
这个答案有帮助(尽管还有另一条错误消息):
我在本地使用 TensorFlow 训练了一个模型并将其上传到 Google Cloud ML Engine。尽管 gcloud ml-engine local predict
的本地测试工作正常,但使用 gcloud ml-engine predict
的在线预测失败并出现此错误:
{ "error": "Prediction failed: Error during model execution: AbortionError(code=StatusCode.INVALID_ARGUMENT, details=\"NodeDef mentions attr 'output_type' not in Op output:int64; attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, DT_UINT16, DT_INT16, DT_INT8, DT_COMPLEX64, DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT32, DT_HALF]; attr=Tidx:type,default=DT_INT32,allowed=[DT_INT32, DT_INT64]>; NodeDef: dnn/head/predictions/class_ids = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, _output_shapes=[[-1]], output_type=DT_INT64, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](dnn/head/logits, dnn/head/predictions/class_ids/dimension)\n\t [[Node: dnn/head/predictions/class_ids = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, _output_shapes=[[-1]], output_type=DT_INT64, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](dnn/head/logits, dnn/head/predictions/class_ids/dimension)]]\")" }
问题是不同版本的 TensorFlow:1.4.1 在我的本地机器上,我用它来训练,1.2 在 Google 云上。使用 CLI 工具时可以指定版本,但不能指定 Google 云 Web 控制台,因此解决方案是使用 gcloud ml-engine versions create
和 --runtime-version=1.4
参数。
这个答案有帮助(尽管还有另一条错误消息):