如何用 tensorflow serving 部署服务

第一步,读一读这篇博客

https://www.jb51.net/article/138932.htm (浅谈Tensorflow模型的保存与恢复加载

第二步:

参考博客:

  • https://blog.csdn.net/u011734144/article/details/82107610

  按照上述教程配置好相关文件之后(模型是下面tensorflow-serving中产生的,直接移到textcnnrnn中的)然后再执行下面命令:

首先启动:

ljj@debian:~$ docker run -p 8501:8501   --mount type=bind,source=/home/ljj/serving/tensorflow_serving/servables/tensorflow/testdata/textcnnrnn,target=/models/find_lemma_category -e MODEL_NAME=find_lemma_category -t tensorflow/serving

然后调用:

ljj@debian:~$ curl --tlsv1.2 -d '{"instances": [10,10,10,8,6,1,8,9,1]}'   -X POST http://0.0.0.0:8501/v1/models/find_lemma_category:predict  

但是出现错误:

{ "error": "instances is a plain list, but expecting list of objects as multiple input tensors required as per tensorinfo_map" }ljj@debian:~$

事故现场:

 

 

 

 

 

 

 

 

 

  • https://www.jianshu.com/p/2fffd0e332bc
  • https://blog.csdn.net/SEUer_jeff/article/details/75578732
  • https://blog.csdn.net/wangjian1204/article/details/68928656

参考教程:

  • https://hub.docker.com/r/bitnami/tensorflow-serving

在这个教程中:https://github.com/tobegit3hub/tensorflow_template_application

在Ubuntu中命令应如下

python sparse_classifier.py train_file ./data/cancer/cancer_train.csv.tfrecords validate_file ./data/cancer/cancer_test.csv.tfrecords feature_size 4 label_size 3  enable_colored_log

 python dense_classifier.py train_file ./data/cancer/cancer_train.csv.tfrecords validate_file ./data/cancer/cancer_test.csv.tfrecords feature_size 4 label_size 3  enable_colored_log

使用dense_classifier.py 即可产生checkpoint文件夹,可供后续在http_service中使用rest_server进行调用。但是具体调用浏览器端仍存在数组越界的问题

 

安装一个命令行下使用的文本浏览器便于测试使用

https://www.cnblogs.com/tsdxdx/p/7221132.html

Debian/Ubuntu:   apt-get install w3m w3m-img

Centos:   yum install w3m w3m-img

 

常见问题

 

不再支持export

    • https://www.jianshu.com/p/91aae37f1da6

 

转载于:https://www.cnblogs.com/theWinter/p/10150579.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值