Bert-as-service 学习

pip3 install --user --upgrade tensorflow 

安装遇到的问题如下:

pip3 install --user --upgrade tensorflow 
 1052  pip uninstall protobuf
 1053  pip3 uninstall protobuf
 1054  pip3 install protobuf==3.20.*
 1055  pip3 install open-clip-torch==2.8.2
 1056  pip3 install --user --upgrade tensorflow 
 1057  pip uninstall protobuf
 1058  pip3 uninstall protobuf
 1059  pip3 install protobuf==3.20.*
 1060  pip3 install --user --upgrade tensorflow 
 1061  pip install protobuf==3.20.*
 

tensorflow-2.11

bert-as-service, 依赖于 python≥3.5 AND tensorflow≥1.10;

参考:Bert- as-service安装和使用教程_bert进入端口-CSDN博客

参考:https://tensorflow.google.cn/install/pip?hl=zh-cn#system-install

BERT 服务化 bert-as-service - 01码匠 - 博客园 (cnblogs.com)

https://blog.csdn.net/luhuibo318/article/details/104925892

下载 https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip

pip3 install bert-serving-server

pip3 install bert-serving-client

pip install bert-serving-server

pip install bert-serving-client

  1. 进入chinese_L-12_H-768_A-12同级目录执行下面命令

python3 start-bert-as-service.py -model_dir /opt/dockerinstall/python3/bert-model/chinese_L-12_H-768_A-12/ -num_worker=2

bert-serving-start -model_dir /opt/dockerinstall/python3/bert-model/chinese_L-12_H-768_A-12/ -num_worker=2

import sys

from bert_serving.server import BertServer
from bert_serving.server.helper import get_run_args


if __name__ == '__main__':
    args = get_run_args()
    server = BertServer(args)
    server.start()
    server.join()

tensorflow 版本太高

安装 pip3 install tensorflow==1.14.0

sudo yum update libstdc++
参考:https://blog.csdn.net/my__blog/article/details/123703024

https://blog.csdn.net/qq_50665031/article/details/108987205

最后启动成功:

待测试:nohup bert-serving-start -model_dir ./chinese_L-12_H-768_A-12/ -num_worker=1 > bert.log 2>&1 &

nohup python3 start-bert-as-service.py -model_dir /opt/dockerinstall/python3/bert-model/chinese_L-12_H-768_A-12/ -num_worker=2  > bert.log 2>&1 &

nohup python3 -m uvicorn main:app --host 192.168.1.243 --port 5001?> bertweb.log 2>&1 &

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值