当前位置:网站首页>nlp模型-bert从入门到精通(二)
nlp模型-bert从入门到精通(二)
2020-11-06 01:22:00 【IT界的小小小学生】
命名实体识别
首先下载相应bert 模块
pip install bert-base==0.0.9 -i https://pypi.python.org/simple
也可参考官网处理
安装
软件包现在支持的功能
1.命名实体识别的训练
2.命名实体识别的服务C/S
3.继承优秀开源软件:bert_as_service(hanxiao)的BERT所有服务
4.文本分类服务
后续功能会继续增加
基于命名行训练命名实体识别模型:
安装完bert-base后,会生成两个基于命名行的工具,其中bert-base-ner-train支持命名实体识别模型的训练,你只需要指定训练数据的目录,BERT相关参数的目录即可。可以使用下面的命令查看帮助
训练的事例命名如下:
bert-base-ner-train \
-data_dir {your dataset dir}\
-output_dir {training output dir}\
-init_checkpoint {Google BERT model dir}\
-bert_config_file {bert_config.json under the Google BERT model dir} \
-vocab_file {vocab.txt under the Google BERT model dir}
参数说明
其中data_dir是你的数据所在的目录,训练数据,验证数据和测试数据命名格式为:train.txt, dev.txt,test.txt,请按照这个格式命名文件,否则会报错。
训练数据的格式如下:
海 O
钓 O
比 O
赛 O
地 O
点 O
在 O
厦 B-LOC
门 I-LOC
与 O
金 B-LOC
门 I-LOC
之 O
间 O
的 O
海 O
域 O
。 O
每行得第一个是字,第二个是它的标签,使用空格’ '分隔,请一定要使用空格。句与句之间使用空行划分。程序会自动读取你的数据。
output_dir: 训练模型输出的文件路径,模型的checkpoint以及一些标签映射表都会存储在这里,这个路径在作为服务的时候,可以指定为-ner_model_dir
init_checkpoint: 下载的谷歌BERT模型
bert_config_file : 谷歌BERT模型下面的bert_config.json
vocab_file: 谷歌BERT模型下面的vocab.txt
训练完成后,你可以在你指定的output_dir中查看训练结果。
更多操作:
https://blog.csdn.net/macanv/article/details/85684284
还有一个bert模型的封装
https://www.jianshu.com/p/1d6689851622
https://cloud.tencent.com/developer/article/1470051
https://www.h3399.cn/201908/714454.html

版权声明
本文为[IT界的小小小学生]所创,转载请带上原文链接,感谢
https://vip01.blog.csdn.net/article/details/100739168
边栏推荐
- Basic principle and application of iptables
- How to get started with new HTML5 (2)
- 选择站群服务器的有哪些标准呢?
- Technical director, to just graduated programmers a word - do a good job in small things, can achieve great things
- Listening to silent words: hand in hand teaching you sign language recognition with modelarts
- 01 . Go语言的SSH远程终端及WebSocket
- [performance optimization] Nani? Memory overflow again?! It's time to sum up the wave!!
- DRF JWT authentication module and self customization
- 读取、创建和运行多个文件的3个Python技巧
- drf JWT認證模組與自定製
猜你喜欢
有关PDF417条码码制的结构介绍
自然语言处理之命名实体识别-tanfordcorenlp-NER(一)
Can't be asked again! Reentrantlock source code, drawing a look together!
Troubleshooting and summary of JVM Metaspace memory overflow
PLC模拟量输入和数字量输入是什么
免费的专利下载教程(知网、espacenet强强联合)
Want to do read-write separation, give you some small experience
drf JWT認證模組與自定製
PPT画成这样,述职答辩还能过吗?
数据产品不就是报表吗?大错特错!这分类里有大学问
随机推荐
一时技痒,撸了个动态线程池,源码放Github了
数字城市响应相关国家政策大力发展数字孪生平台的建设
【效能優化】納尼?記憶體又溢位了?!是時候總結一波了!!
drf JWT認證模組與自定製
Pattern matching: The gestalt approach一种序列的文本相似度方法
Didi elasticsearch cluster cross version upgrade and platform reconfiguration
從小公司進入大廠,我都做對了哪些事?
Don't go! Here is a note: picture and text to explain AQS, let's have a look at the source code of AQS (long text)
Microservices: how to solve the problem of link tracing
车的换道检测
DTU连接经常遇到的问题有哪些
hadoop 命令总结
Leetcode's ransom letter
大数据应用的重要性体现在方方面面
PPT画成这样,述职答辩还能过吗?
Cos start source code and creator
DRF JWT authentication module and self customization
WeihanLi.Npoi 1.11.0/1.12.0 Release Notes
接口压力测试:Siege压测安装、使用和说明
如果前端不使用SPA又能怎样?- Hacker News