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
- 进入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 &