bert-as-service 小白使用记录

bert-as-service安装

之前做NLP任务的时候,比较喜欢用word2vec对词向量进行训练,然后作为神经网络的初始化输入。同事说你应该试试bert,bert效果可好了。对于这个领域的小白,我首先想到了bert-as-service,这里十分感谢肖涵博士。

bert-as-service安装很简单,直接pip install bert-serving-server; pip install bert-serving-client.这俩版本最好一致。

然后就是下载需要的已经训练好的语料,语料可以参考:
https://github.com/google-research/bert#pre-trained-models
以及:
https://github.com/ymcui/Chinese-BERT-wwm

bert-as service使用

上面两个步骤完成后,打开一个cmd窗口,输入:
bert-serving-start -model_dir E:\Papers\bert\chinese_L-12_H-768_A-12
其中E:\Papers\bert\chinese_L-12_H-768_A-12是下载的预训练语料的存储路径,这个chinese_L-12_H-768_A-12里面包括:
bert_config.json
bert_model.ckpt.data-00000-of-00001
bert_model.ckpt.index
bert_model.ckpt.meta
vocab.txt
即预训练的配置,模型以及单词和字母表。

然后你的cmd窗口中

评论 18
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值