使用 docker 在 Tensorflow 服务中遇到问题
Facing Problem in Tensorflow serving with docker
我正在使用 Tensorflow 服务 docker。我使用了TensorFlow官方文档中提到的代码如下(使用Windows PowerShell)
docker pull tensorflow/serving
git clone https://github.com/tensorflow/serving
Set-Variable -Name "TESTDATA" -Value "$(pwd)/serving/tensorflow_serving/servables/tensorflow/testdata"
docker run -t --rm -p 8501:8501 -v "$TESTDATA/saved_model_half_plus_two_cpu:/models/half_plus_two" -e MODEL_NAME=half_plus_two tensorflow/serving
在 运行 上面的代码之后得到这个
2020-05-08 04:50:41.577978: I tensorflow_serving/model_servers/server.cc:86] Building single TensorFlow model file config: model_name: half_plus_two model_base_path: /models/half_plus_two
2020-05-08 04:50:41.581575: I tensorflow_serving/model_servers/server_core.cc:462] Adding/updating models.
2020-05-08 04:50:41.581678: I tensorflow_serving/model_servers/server_core.cc:573] (Re-)adding model: half_plus_two
2020-05-08 04:50:41.780628: I tensorflow_serving/core/basic_manager.cc:739] Successfully reserved resources to load servable {name: half_plus_two version: 123}
2020-05-08 04:50:41.780738: I tensorflow_serving/core/loader_harness.cc:66] Approving load for servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.780778: I tensorflow_serving/core/loader_harness.cc:74] Loading servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.781020: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /models/half_plus_two/00000123
2020-05-08 04:50:41.793200: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2020-05-08 04:50:41.793300: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:264] Reading SavedModel debug info (if present) from: /models/half_plus_two/00000123
2020-05-08 04:50:41.797324: I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-05-08 04:50:41.844706: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:203] Restoring SavedModel bundle.
2020-05-08 04:50:41.881278: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:152] Running initialization op on SavedModel bundle at path: /models/half_plus_two/00000123
2020-05-08 04:50:41.887881: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:333] SavedModel load for tags { serve }; Status: success: OK. Took 106866 microseconds.
2020-05-08 04:50:41.889403: I tensorflow_serving/servables/tensorflow/saved_model_warmup.cc:105] No warmup data file found at /models/half_plus_two/00000123/assets.extra/tf_serving_warmup_requests
2020-05-08 04:50:41.895569: I tensorflow_serving/core/loader_harness.cc:87] Successfully loaded servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.901866: I tensorflow_serving/model_servers/server.cc:358] Running gRPC ModelServer at 0.0.0.0:8500 ...
[warn] getaddrinfo: address family for nodename not supported
[evhttp_server.cc : 238] NET_LOG: Entering the event loop ...
2020-05-08 04:50:41.907795: I tensorflow_serving/model_servers/server.cc:378] Exporting HTTP/REST API at:localhost:8501 ...
等待一个小时 运行 下一个命令。
我该怎么办伙计们?任何想法请帮助
我相信,现在您的服务器 运行 没问题了。只需打开一个新的 window,您就可以向它发出 http 请求。我参考了文档,你所做的是正确的,它是日志的理想性质。
tensorflow procedure
只需按照文档中的后续步骤操作即可:
# Query the model using the predict API
curl -d '{"instances": [1.0, 2.0, 5.0]}' \
-X POST http://localhost:8501/v1/models/half_plus_two:predict
# Returns => { "predictions": [2.5, 3.0, 4.5] }
我正在使用 Tensorflow 服务 docker。我使用了TensorFlow官方文档中提到的代码如下(使用Windows PowerShell)
docker pull tensorflow/serving
git clone https://github.com/tensorflow/serving
Set-Variable -Name "TESTDATA" -Value "$(pwd)/serving/tensorflow_serving/servables/tensorflow/testdata"
docker run -t --rm -p 8501:8501 -v "$TESTDATA/saved_model_half_plus_two_cpu:/models/half_plus_two" -e MODEL_NAME=half_plus_two tensorflow/serving
在 运行 上面的代码之后得到这个
2020-05-08 04:50:41.577978: I tensorflow_serving/model_servers/server.cc:86] Building single TensorFlow model file config: model_name: half_plus_two model_base_path: /models/half_plus_two
2020-05-08 04:50:41.581575: I tensorflow_serving/model_servers/server_core.cc:462] Adding/updating models.
2020-05-08 04:50:41.581678: I tensorflow_serving/model_servers/server_core.cc:573] (Re-)adding model: half_plus_two
2020-05-08 04:50:41.780628: I tensorflow_serving/core/basic_manager.cc:739] Successfully reserved resources to load servable {name: half_plus_two version: 123}
2020-05-08 04:50:41.780738: I tensorflow_serving/core/loader_harness.cc:66] Approving load for servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.780778: I tensorflow_serving/core/loader_harness.cc:74] Loading servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.781020: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /models/half_plus_two/00000123
2020-05-08 04:50:41.793200: I external/org_tensorflow/tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2020-05-08 04:50:41.793300: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:264] Reading SavedModel debug info (if present) from: /models/half_plus_two/00000123
2020-05-08 04:50:41.797324: I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-05-08 04:50:41.844706: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:203] Restoring SavedModel bundle.
2020-05-08 04:50:41.881278: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:152] Running initialization op on SavedModel bundle at path: /models/half_plus_two/00000123
2020-05-08 04:50:41.887881: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:333] SavedModel load for tags { serve }; Status: success: OK. Took 106866 microseconds.
2020-05-08 04:50:41.889403: I tensorflow_serving/servables/tensorflow/saved_model_warmup.cc:105] No warmup data file found at /models/half_plus_two/00000123/assets.extra/tf_serving_warmup_requests
2020-05-08 04:50:41.895569: I tensorflow_serving/core/loader_harness.cc:87] Successfully loaded servable version {name: half_plus_two version: 123}
2020-05-08 04:50:41.901866: I tensorflow_serving/model_servers/server.cc:358] Running gRPC ModelServer at 0.0.0.0:8500 ...
[warn] getaddrinfo: address family for nodename not supported
[evhttp_server.cc : 238] NET_LOG: Entering the event loop ...
2020-05-08 04:50:41.907795: I tensorflow_serving/model_servers/server.cc:378] Exporting HTTP/REST API at:localhost:8501 ...
等待一个小时 运行 下一个命令。 我该怎么办伙计们?任何想法请帮助
我相信,现在您的服务器 运行 没问题了。只需打开一个新的 window,您就可以向它发出 http 请求。我参考了文档,你所做的是正确的,它是日志的理想性质。
tensorflow procedure
只需按照文档中的后续步骤操作即可:
# Query the model using the predict API
curl -d '{"instances": [1.0, 2.0, 5.0]}' \
-X POST http://localhost:8501/v1/models/half_plus_two:predict
# Returns => { "predictions": [2.5, 3.0, 4.5] }