系统信息
- Linux Ubuntu 16.04:
- 从 pip (1.10.1)安装的 TensorFlow Serving :
- TensorFlow 服务版本 1.10.1:
描述问题
我在服务自己的模型时发现了一个有线错误消息,我用saved_model.load测试了.pb文件,一切都很好,但是当我通过客户端发送请求时,报告以下错误:
<_Rendezvous 的 RPC 终止于:status = StatusCode.INVALID_ARGUMENT details = "Tensor :0, 在图中未找到 feed_devices 或 fetch_devices 中指定的" debug_error_string = "{"created":"@1537040456.210975912","description": "从对等方收到错误","file":"src/core/lib/surface/call.cc","file_line":1099,"grpc_message":" Tensor :0,在 feed_devices 或 fetch_devices 中未找到图表","grpc_status":3}" >
连线部分是报告未找到的张量没有名称,我猜这是因为客户端要求输入这个空张量。但我只是不知道这个操作可能来自哪里。
复制的确切步骤
我基于mnist客户端和inception客户端示例代码构建服务,导出的.pb模型已经通过tf.saved_model.loader.load重新加载测试成功,所以我认为问题是由请求引起的。
这是客户端代码的一部分:
channel = grpc.insecure_channel(FLAGS.server)
stub = prediction_service_pb2_grpc.PredictionServiceStub(channel)
request = predict_pb2.PredictRequest()
request.model_spec.name = 'chiron'
request.model_spec.signature_name = tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY
collector = _Result_Collection()
for batch_x,seq_len,i,f,N,reads_n in data_iterator(FLAGS.raw_dir):
request.inputs['signals'].CopyFrom(
tf.contrib.util.make_tensor_proto(batch_x, shape=[FLAGS.batch_size, CONF.SEGMENT_LEN]))
request.inputs['seq_length'].CopyFrom(
tf.contrib.util.make_tensor_proto(seq_len, shape=[FLAGS.batch_size]))
result_future = stub.Predict.future(request, 5.0) # 5 seconds
result_future.add_done_callback(_post_process(collector,i,f))