Masked Language Modeling -- MLM

Masked Language Modeling with Code Explaination, MLM及相关代码说明

Knowledge graph 本篇所涉及的知识点

  • BERT concept and theory
  • BERT application
  • MLM: introduction and way to use
  • NLP
  • next sentence prediction (NSP)

Masked language Modeling(MLM)

关于BERT和MLM:

  • BERT可以很方便地用于应用领域;
  • BERT + MLM可以方便应用于特定领域及问题中;

Here I would like to introduce Masked language Modeling(MLM). Before the introduction, there are some basic ideas you need to know about BERT and MLM:

  • BERT is easy to use in a general purpose of use;
  • BERT with MLM can be used in specific areas and domains.

BERT + MLM 的思想在于:
在数据输入BERT训练前,使用MLM遮盖部分数据,然后让BERT填补这部分数据;MLM所遮盖的部分,可以是随机性遮盖一定比例的。

(mask some tokens before training in BERT; let BERT fill the missing part of the text)

使用BERT + MLM的过程

The whole processes:

  • 文本特征化后得到三个张量 tokenize the text, after this, we will get three tensors:
    • input_ids – this is what will be used as input to BERT
    • token_type_ids – not necessary for MLM
    • attention_mask
  • 标签张量label tensors:
    • calculate loss against and optimize towards
    • simply input_ids – 只对这个张量进行操作
  • MLM遮盖数据集 randomly mask some tokens in input_ids
    • 15% of masking the tokens in pre-training model process.
  • 计算损失函数 calculate loss – used for optimization the model
    • input input_ids and labels in BERT
    • do the calculation

                
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值