【发布时间】:2018-09-17 17:44:53
【问题描述】:
系统信息
- Linux Ubuntu 16.04:
- 从 pip 安装的 TensorFlow Serving (1.10.1):
- TensorFlow Serving 1.10.1 版:
描述问题
在为自己的模型提供服务时发现有线错误消息,我用saved_model.load测试了.pb文件,一切正常,但是当我通过客户端发送请求时,报告以下错误:
<_rendezvous rpc status="StatusCode.INVALID_ARGUMENT" details="在图中未找到在 feed_devices 或 fetch_devices 中指定的张量:0" debug_error_string="{" created>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))
【问题讨论】:
标签: python tensorflow tensor serving