centos8 安装docker 实现 tensoflow 模型的部署

1.首先为cenos8系统安装 docker

使用国内 daocloud 一键安装命令:

curl -sSL https://get.daocloud.io/docker | sh

使用docker ps 会提示 docker 为启动。这时使用 systemctl start docker启动docker。启动docker后可以再次使用 docker ps验证是否启动。

确保安装启动好docker后,可以浏览tensorflow的官方文档,这里介绍了tensorflow提供的一个工具 TensorFlow Serving,这个工具可以将训练好的模型直接上线并提供服务。用户可以使用 基于gRPC或RESTfull API的方式,去调用模型得到返回结果。

https://www.tensorflow.org/tfx/serving/docker
在这里插入图片描述

# 下面是 Tensorflow 官方提供的 Tensorflow Serving 使用方法

# Download the TensorFlow Serving Docker image and repo
docker pull tensorflow/serving				#下拉 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 => { "predictions": [2.5, 3.0, 4.5] }

执行文档命令行过程中可能会遇到的问题:
1.在执行 git Clone 是 如果提示未找到命令,则执行yum install -y git安装git工具。
然后再 git clone https://github.com/tensorflow/serving 这是tensorflow的开源代码。其中含有一些示例模型,这里我们就是使用 一个简单模型来模拟 tensorflow模型的部署。
2.在执行docker run -t --rm时,可能会遇到一下错误。
在这里插入图片描述
解决方法:安装 libseccomp-devel ,yum install libseccomp-devel

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云淡风轻~~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值