目录
https://github.com/hanxiao/bert-as-service
官网:https://bert-as-service.readthedocs.io/en/latest/
pip install -U bert-serving-server bert-serving-client
要求:
另外需要把预训练好的模型下下来~
$workspace/bin/python3.6 \
$workspace/bin/bert-serving-start \
-model_dir=$workspace/../chinese_L-12_H-768_A-12/ \
-num_worker=4
from bert_serving.client import BertClient
remote_ip = 'xx.xx.xx.xx'
bc = BertClient(ip=remote_ip)
print(bc.encode(['First do it', 'then do it right', 'then do it better']))