当前位置:网站首页>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
边栏推荐
- 7.3.1 file upload and zero XML registration interceptor
- 7.2.2 compressing static resources through gzipresourceresolver
- 50 + open source projects are officially assembled, and millions of developers are voting
- 免费的专利下载教程(知网、espacenet强强联合)
- 对pandas 数据进行数据打乱并选取训练机与测试机集
- 哇,ElasticSearch多字段权重排序居然可以这么玩
- 2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
- 6.7 theme resolver theme style parser (in-depth analysis of SSM and project practice)
- 事半功倍:在没有机柜的情况下实现自动化
- 嘘!异步事件这样用真的好么?
猜你喜欢

Technical director, to just graduated programmers a word - do a good job in small things, can achieve great things

人工智能学什么课程?它将替代人类工作?

Examples of unconventional aggregation

阿里云Q2营收破纪录背后,云的打开方式正在重塑

ipfs正舵者Filecoin落地正当时 FIL币价格破千来了

制造和新的自动化技术是什么?

How do the general bottom buried points do?

通过深层神经网络生成音乐

谁说Cat不能做链路跟踪的,给我站出来

快快使用ModelArts,零基礎小白也能玩轉AI!
随机推荐
Analysis of ThreadLocal principle
iptables基礎原理和使用簡介
A debate on whether flv should support hevc
Flink on paasta: yelp's new stream processing platform running on kubernetes
幽默:黑客式编程其实类似机器学习!
Microservices: how to solve the problem of link tracing
连肝三个通宵,JVM77道高频面试题详细分析,就这?
Grouping operation aligned with specified datum
深度揭祕垃圾回收底層,這次讓你徹底弄懂她
你的财务报告该换个高级的套路了——财务分析驾驶舱
Pycharm快捷键 自定义功能形式
使用 Iceberg on Kubernetes 打造新一代云原生数据湖
Technical director, to just graduated programmers a word - do a good job in small things, can achieve great things
[performance optimization] Nani? Memory overflow again?! It's time to sum up the wave!!
(1)ASP.NET Core3.1 Ocelot介紹
01 . Go语言的SSH远程终端及WebSocket
ThreadLocal原理大解析
C++和C++程序员快要被市场淘汰了
2018个人年度工作总结与2019工作计划(互联网)
Elasticsearch 第六篇:聚合統計查詢