TensorFlow Serving with Docker
使用docker的TensorFlow Serving相关部署流程,在tensorflow的网站上演示的比较清楚链接: https://tensorflow.google.cn/tfx/serving/docker?hl=zh_cn。远程服务器的部署有几个具体细节问题在实际踩坑之后才注意到,所以在这里作为记录。目的是使用centos的一台服务器部署TensorFlow Serving并远程调用模型实现数字分类任务。
先看官方示例流程如下:
# Download the TensorFlow Serving Docker image and repo
docker pull tensorflow/serving
git clone https://github.com/tensorflow/serving
# Location of demo models
TESTDATA="$(pwd)/serving/tensorflow_serving/servables/tensorflow/testdata"
# Start TensorFlow Serving container and open the REST API port
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 &
# 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 => { "predic