当前版本的tensorflow-serving尝试从asset.extra / tf_serving_warmup_requests文件加载预热请求。
2018-08-16 16:05:28.513085:I tensorflow_serving / servables / tensorflow / saved_model_warmup.cc:83]在/tmp/faster_rcnn_inception_v2_coco_2018_01_28_string_input_version-export/1/assets.extra/tf_serving_warmup上未找到热身数据文件
我想知道tensorflow是否提供通用的api将请求导出到该位置吗?还是我们应该手动将请求写到该位置?
目前,尚无用于将预热数据导出到asset.extra的通用API。编写脚本相对简单(类似于以下内容):
import tensorflow as tf from tensorflow_serving.apis import model_pb2 from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis import prediction_log_pb2 def main(): with tf.python_io.TFRecordWriter("tf_serving_warmup_requests") as writer: request = predict_pb2.PredictRequest( model_spec=model_pb2.ModelSpec(name=""), inputs={"examples": tf.make_tensor_proto([ ])} ) log = prediction_log_pb2.PredictionLog( predict_log=prediction_log_pb2.PredictLog(request=request)) writer.write(log.SerializeToString()) if __name__ == "__main__": main()