tensorflow环境配置记录备忘
pip install tensorflow==1.15-ihttps://pypi.tuna.tsinghua.edu.cn/simple--default-timeout=1000pip installtensorflow-serving-api==1.15-ihttps://pypi.tuna.tsinghua.edu.cn/simple--default-timeout=1000
ubuntu16.04安装docker步骤:(必须安装特定版本)
1、
sudo apt-get remove docker docker-engine docker.io
2、
sudo apt-get update
3、
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
4、
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5、
sudo add-apt-repository \
"deb https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
6、
sudo apt-get update
7、
sudo apt-get install docker-ce=17.03.2~ce-0~ubuntu-xenial
sudo service docker start
sudo docker version
ubuntu16.04更新阿里源:
https://www.cnblogs.com/mufire/p/6433757.html
https://blog.csdn.net/u012433049/article/details/88972850
部署
git clone https://github.com/tensorflow/serving
设置docker镜像
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
sudo service docker restart,重启docker,然后拉取tf_serve
sudo docker images查看镜像有没有
用下面那个
sudo docker run --runtime=cpu -p 8501:8501 \
--mount type=bind,\
source=/home/szl/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two_cpu,\
target=/models/half_plus_two \
-e MODEL_NAME=half_plus_two -t tensorflow/serving &
sudo docker run -t --rm -p 8501:8501 \
-v "$(pwd)/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two_cpu:/models/half_plus_two" \
-e MODEL_NAME=half_plus_two \
tensorflow/serving &
sudo curl -d '{"instances": }' \
-X POST http://localhost:8501/v1/models/half_plus_two:predict
查看容器id
sudo docker ps
pb文件生成:ddz_saved_model.py
使用demo:play_game_client.py
ckpt是已经训练好的checkpoint模型文件
页:
[1]