Python Tensorflow';找不到元图Def
我正在尝试使用Tensorflow服务(加载到docker上,如果这有什么区别的话)为经过培训的Tensorflow模型提供服务 培训完模型后,我使用以下代码保存了它:Python Tensorflow';找不到元图Def,python,tensorflow,tensorflow-serving,Python,Tensorflow,Tensorflow Serving,我正在尝试使用Tensorflow服务(加载到docker上,如果这有什么区别的话)为经过培训的Tensorflow模型提供服务 培训完模型后,我使用以下代码保存了它: prediction_signature = ( tf.saved_model.signature_def_utils.build_signature_def( inputs={'verif': tensor_info_input, 'enroll': tensor_inf
prediction_signature = (
tf.saved_model.signature_def_utils.build_signature_def(
inputs={'verif': tensor_info_input, 'enroll': tensor_info_input},
outputs={'similarity_matrix': tensor_info_output},
method_name=tf.saved_model.signature_constants.PREDICT_METHOD_NAME))
with tf.Session(graph=loaded_graph) as sess:
# Restore from checkpoint
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta')
loader.restore(sess, trained_checkpoint_prefix)
# Export checkpoint to SavedModel
builder = tf.saved_model.builder.SavedModelBuilder(export_dir)
builder.add_meta_graph_and_variables(sess,
[tf.saved_model.TRAINING, tf.saved_model.SERVING],
signature_def_map={
tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY: prediction_signature,
})
builder.save()
在版本文件夹上使用--all标志运行saved_model_cli后,我得到以下响应:
但是-在尝试发球时,我仍然会遇到以下错误:
加载可服务:{name:服务版本:0}失败:找不到:无法
找不到与提供的标记匹配的元图def:{serve}
你知道这是什么原因吗
谢谢经过多次尝试和错误,问题似乎是我有tf.saved_model.TRAINING和tf.saved_model.service标签 当我在构建模型时移除tf.saved_model.TRAINING标签时,一切都正常了
MetaGraphDef with tag-set: 'train, serve' contains the following SignatureDefs:
signature_def['serving_default']: The given SavedModel SignatureDef contains the following input(s):
inputs['enroll'] tensor_info:
dtype: DT_FLOAT
shape: (80, 20, 40)
name: Const:0
inputs['verif'] tensor_info:
dtype: DT_FLOAT
shape: (80, 20, 40)
name: Const:0 The given SavedModel SignatureDef contains the following output(s):
outputs['similarity_matrix'] tensor_info:
dtype: DT_FLOAT
shape: (20, 4)
name: add_1:0 Method name is: tensorflow/serving/predict