选择anaconda 3.5.2 对应的python版本是python3.6
依次安装,问题Baidu
pip install --user tensorflow==1.10.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install bert-serving-server -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install bert-serving-client -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
1种:
链接: https://pan.baidu.com/s/1CdyHz-Tv3l_72ZjR3Sv8PQ 提取码: ambr
2种:
https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip
外网速度快
cd E:/bert
解压 chinese_L-12_H-768_A-12.zip
bert-serving-start -model_dir chinese_L-12_H-768_A-12/ -num_worker=1
python
from bert_serving.client import BertClient
bc = BertClient(ip='localhost',check_version=False,port=5555, port_out=5556, check_length=False,timeout=10000)
bc.encode(['我爱你', '你爱我'])
array([[ 0.37820056, 0.112949 , -0.21374373, ..., -0.15088102,
0.23272948, -0.47062612],
[ 0.3381107 , 0.06517199, -0.15245143, ..., -0.16170141,
0.01764984, -0.34359008]], dtype=float32)