TensorFlow Serving is a flexible, high-performance serving system for machine learning models, designed for production environments.
下载镜像
docker pull tensorflow/serving
网络原因,可能会导致timeout,多尝试几次。
clone代码
git clone https://github.com/tensorflow/serving
启动镜像
docker run -t --rm -p 8501:8501 \
-v "/root/tf-serving/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two_cpu:/models/half_plus_two" \
-e MODEL_NAME=half_plus_two \
tensorflow/serving &_model_half_plus_two_cpu:/models/half_plus_two" \
-e MODEL_NAME=half_plus_two \
tensorflow/serving &
启动后。。。
测试
curl -d '{"instances": [1.0, 2.0, 5.0]}' \
-X POST http://localhost:8501/v1/models/half_plus_two:predict
测试成功。。。
遇到的问题
No versions of servable half_plus_two found under base path /models/half_plus_two
解决方案
创建目录:/models/half_plus_two
参考
Serve a Tensorflow model in 60 seconds
作者:Wuxinshui
出处:http://wuxinshui.github.io
版权归作者所有,转载请注明出处