Tensorflow 服务和客户端调用失败

Tensorflow serving and client call failed

有什么问题吗,因为我在 (localhost:8517 或 10.110.110.13:8517) 的帮助下尝试进行客户端调用时出现连接失败

root@ubuntu-xenial:~/serving# docker run -p 8517:8517 --mount type=bind,source=/root/serving/Ser_Model,target=/models/firstmodel -e MODEL_NAME=firstmodel -t tensorflow/serving
2018-12-18 22:42:54.202137: I tensorflow_serving/model_servers/server.cc:82] Building single TensorFlow model file config:  model_name: firstmodel model_base_path: /models/firstmodel
2018-12-18 22:42:54.203105: I tensorflow_serving/model_servers/server_core.cc:461] Adding/updating models.
2018-12-18 22:42:54.203162: I tensorflow_serving/model_servers/server_core.cc:558]  (Re-)adding model: firstmodel
2018-12-18 22:42:54.305763: I tensorflow_serving/core/basic_manager.cc:739] Successfully reserved resources to load servable {name: firstmodel version: 1}
2018-12-18 22:42:54.305814: I tensorflow_serving/core/loader_harness.cc:66] Approving load for servable version {name: firstmodel version: 1}
2018-12-18 22:42:54.305856: I tensorflow_serving/core/loader_harness.cc:74] Loading servable version {name: firstmodel version: 1}
2018-12-18 22:42:54.305899: I external/org_tensorflow/tensorflow/contrib/session_bundle/bundle_shim.cc:363] Attempting to load native SavedModelBundle in bundle-shim from: /models/firstmodel/1
2018-12-18 22:42:54.306021: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /models/firstmodel/1
2018-12-18 22:42:54.313227: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2018-12-18 22:42:54.314376: I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-12-18 22:42:54.341301: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:162] Restoring SavedModel bundle.
2018-12-18 22:42:54.354011: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:138] Running MainOp with key legacy_init_op on SavedModel bundle.
2018-12-18 22:42:54.354072: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:259] SavedModel load for tags { serve }; Status: success. Took 48045 microseconds.
2018-12-18 22:42:54.354116: I tensorflow_serving/servables/tensorflow/saved_model_warmup.cc:83] No warmup data file found at /models/firstmodel/1/assets.extra/tf_serving_warmup_requests
2018-12-18 22:42:54.354305: I tensorflow_serving/core/loader_harness.cc:86] Successfully loaded servable version {name: firstmodel version: 1}
2018-12-18 22:42:54.356224: I tensorflow_serving/model_servers/server.cc:286] Running gRPC ModelServer at 0.0.0.0:8500 ...
[warn] getaddrinfo: address family for nodename not supported
2018-12-18 22:42:54.356982: I tensorflow_serving/model_servers/server.cc:302] Exporting HTTP/REST API at:localhost:8501 ...
[evhttp_server.cc : 237] RAW: Entering the event loop ...

正在尝试获取模型的状态如下:

$ curl http://localhost:8517/v1/models/firstmodel

但是我收到了错误信息curl: (56) Recv failure: Connection reset by peer

你能通过 docker 找出我的服务命令有什么问题吗?

端口的使用(8500 用于 GRPC 和 8501 用于 RESTful API)问题很多并且 link of

为 GRPC 客户服务

docker run -p 8500:8500 --mount type=bind,source=/root/serving/Ser_Model,target=/models/firstmodel -e MODEL_NAME=firstmodel -t tensorflow/serving

服务 RESTful API 个客户

 docker run -p 8501:8501 --mount type=bind,source=/root/serving/Ser_Model,target=/models/firstmodel -e MODEL_NAME=firstmodel -t tensorflow/serving

您还可以查看 RESTful api 客户端和调用的状态,

curl http://localhost:8501/v1/models/firstmodel

curl -d '{"signature_name":"predict_output","instances":[2.0,9.27]}' -X POST http://10.110.110.13:8501/v1/models/firstmodel:predict

8517 是您的 docker 容器公开的端口。但是您在容器中的端口 8500 和 8501 上启动了 tf-server。如果你想让它工作,请将你的 docker cmd 更改为 docker run -p 8501:8501 xxx,并将请求 url 更改为 localhost:8501/xxx/xxx.