我使用SavedModel(Inception_resnet_v2)导出TensorFlow模型文件并使用TensorFlow服务来加载文件。我已经用我自己的Inception_resnet_v2 saved_model.pb文件直接替换了官方最小的saved_model.pb。但我有一个错误。
deep@ubuntu:~/serving$ bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port=9000 --model_name=mnist --model_base_path=/home/deep/serving/tmp/mnist_model
2017-06-18 10:39:41.963490: I tensorflow_serving/model_servers/main.cc:146] Building single TensorFlow model file config: model_name: mnist model_base_path: home/deep/serving/tmp/mnist_model model_version_policy: 0
2017-06-18 10:39:41.963752: I tensorflow_serving/model_servers/server_core.cc:375] Adding/updating models.
2017-06-18 10:39:41.963762: I tensorflow_serving/model_servers/server_core.cc:421] (Re-)adding model: mnist
2017-06-18 10:39:42.065556: I tensorflow_serving/core/basic_manager.cc:698] Successfully reserved resources to load servable {name: mnist version: 1}
2017-06-18 10:39:42.065610: I tensorflow_serving/core/loader_harness.cc:66] Approving load for servable version {name: mnist version: 1}
2017-06-18 10:39:42.065648: I tensorflow_serving/core/loader_harness.cc:74] Loading servable version {name: mnist version: 1}
2017-06-18 10:39:42.065896: I external/org_tensorflow/tensorflow/contrib/session_bundle/bundle_shim.cc:360] Attempting to load native SavedModelBundle in bundle-shim from: /home/deep/serving/tmp/mnist_model/1
2017-06-18 10:39:42.066130: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:226] Loading SavedModel from: /home/deep/serving/tmp/mnist_model/1
2017-06-18 10:39:42.080775: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:274] Loading SavedModel: fail. Took 14816 microseconds.
2017-06-18 10:39:42.080822: E tensorflow_serving/util/retrier.cc:38] Loading servable: {name: mnist version: 1} failed: Not found: Could not find meta graph def matching supplied tags.
我该怎么办?谢谢!
答案 0 :(得分:6)
我和服务工程师聊了聊,以下是他们对此的一些看法:
看起来他们需要在已保存的模型中指定标签,或者在其上 命令行。 (记录日志:失败:未找到:找不到 元图def def匹配提供的标签。 )
看起来SavedModel加载器无法找到图形 对应于他们提供的标签。这是一些 文档: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/python/saved_model#tags
啊,添加:他们可以使用SavedModel CLI来检查模型和 看看有哪些标签集可用。这是以下文档: https://www.tensorflow.org/versions/master/programmers_guide/saved_model_cli
他们可以运行
saved_model_cli show --dir <SavedModelDir>
检查SavedModel中有哪些标记集,如果它们有pip 安装tensorflow。