前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >BERT-Bidirectional Encoder Representations from Transformers

BERT-Bidirectional Encoder Representations from Transformers

作者头像
百川AI
发布2021-10-19 16:56:33
6090
发布2021-10-19 16:56:33
举报
文章被收录于专栏:我还不懂对话我还不懂对话

BERT, or Bidirectional Encoder Representations from Transformers

BERT是google最新提出的NLP预训练方法,在大型文本语料库(如维基百科)上训练通用的“语言理解”模型,然后将该模型用于我们关心的下游NLP任务(如分类、阅读理解)。 BERT优于以前的方法,因为它是用于预训练NLP的第一个**无监督深度双向**系统。

简单的说就是吊打以前的模型,例如 Semi-supervised Sequence Learning,Generative Pre-Training,ELMo, ULMFit,在多个语言任务上(SQuAD, MultiNLI, and MRPC)基于BERT的模型都取得了state of the art的效果。

BERT 的核心过程:

从句子中随机选取15%去除,作为模型预测目标,例如:

代码语言:javascript
复制
Input: the man went to the [MASK1] . he bought a [MASK2] of milk.
Labels: [MASK1] = store; [MASK2] = gallon

为了学习句子之间的关系。会从数据集抽取两个句子,其中第二句是第一句的下一句的概率是 50%,

代码语言:javascript
复制
Sentence A: the man went to the store .
Sentence B: he bought a gallon of milk .
Label: IsNextSentence
代码语言:javascript
复制
Sentence A: the man went to the store .
Sentence B: penguins are flightless .
Label: NotNextSentence

最后再将经过处理的句子传入大型 Transformer 模型,并通过两个损失函数同时学习上面两个目标就能完成训练。

主要在于Transformer模型。后续需要再分析其模型机构以及设计思想。

预训练模型

  • BERT-Base, Uncased: 12-layer, 768-hidden, 12-heads, 110M parameters
  • BERT-Large, Uncased: 24-layer, 1024-hidden, 16-heads, 340M parameters
  • BERT-Base, Cased: 12-layer, 768-hidden, 12-heads , 110M parameters
  • BERT-Large, Cased: 24-layer, 1024-hidden, 16-heads, 340M parameters (Not available yet. Needs to be re-generated).
  • BERT-Base, Multilingual: 102 languages, 12-layer, 768-hidden, 12-heads, 110M parameters
  • BERT-Base, Chinese: Chinese Simplified and Traditional, 12-layer, 768-hidden, 12-heads, 110M parameters

其中包含:

  • A TensorFlow checkpoint (bert_model.ckpt) containing the pre-trained weights (which is actually 3 files).
  • A vocab file (vocab.txt) to map WordPiece to word id.
  • A config file (bert_config.json) which specifies the hyperparameters of the model.

其他语言见: Multilingual README。开放了中文数据集。

(算力紧张情况下单独训练了一版中文,中文影响力可见一斑,我辈仍需努力啊)

更多细节见: https://github.com/google-research/bert

Reference

  1. GitHub(TensorFlow): https://github.com/google-research/bert
  2. PyTorch version of BERT :https://github.com/huggingface/pytorch-pretrained-BERT
  3. BERT-Base, Chinese: https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip
  4. 论文: https://arxiv.org/abs/1810.04805.
本文参与?腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-11-06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体同步曝光计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • BERT 的核心过程:
  • 预训练模型
  • Reference
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com