为Bert_多任务学习模型提供服务(客户端)
bert-multitask-client的Python项目详细描述
伯特多任务即服务
提供服务安装
pip install bert-multitask-server pip install bert-multitask-client
开始
火车和出口模型。
典型的训练有素的检查点目录如下所示。
bert_serving_ckpt/ ├── *_label_encoder.pkl ├── bert_config.json ├── export_model ├── params.json └── vocab.txt
使用cli启动服务器
bert-multitask-serving-start -model_dir ~/CWS_NER_POS_ckpt/ -num_worker=4 -problem "CWS|NER|POS"
使用客户端获取预测
frombert_serving.clientimportBertClientbc=BertClient()bc.encode(['我爱北京天安门'])
伯特
一{a2}
pip install bert-multitask-server
pip install bert-multitask-client
使用
训练模型并导模型。
[谚]
bert_serving_ckpt/
├── *_label_encoder.pkl
├── bert_config.json
├── export_model
├── params.json
└── vocab.txt
命令
bert-multitask-serving-start -model_dir models/ -num_worker=4 -problem "fake_problem"
预测投资
frombert_serving.clientimportBertClientbc=BertClient()bc.encode(['我爱北京天安门'])
pip install bert-multitask-server pip install bert-multitask-client
使用
训练模型并导模型。
[谚]
bert_serving_ckpt/ ├── *_label_encoder.pkl ├── bert_config.json ├── export_model ├── params.json └── vocab.txt
命令
bert-multitask-serving-start -model_dir models/ -num_worker=4 -problem "fake_problem"
预测投资
frombert_serving.clientimportBertClientbc=BertClient()bc.encode(['我爱北京天安门'])