Commit bdb756f1 authored by yuguo's avatar yuguo
Browse files
parents dfc186ee 3e4fc31b
......@@ -2,7 +2,7 @@
## 模型介绍
BERT的全称为Bidirectional Encoder Representation from Transformers,是一个预训练的语言表征模型。它强调了不再像以往一样采用传统的单向语言模型或者把两个单向语言模型进行浅层拼接的方法进行预训练,而是采用新的**masked language model(MLM)**,以致能生成**深度的双向**语言表征。
## 模型结构
以往的预训练模型的结构会受到单向语言模型*(从左到右或者从右到左*的限制,因而也限制了模型的表征能力,使其只能获取单方向的上下文信息。而BERT利用MLM进行预训练并且采用深层的双向Transformer组件*(单向的Transformer一般被称为Transformer decoder,其每一个token(符号)只会attend到目前往左的token。而双向的Transformer则被称为Transformer encoder,其每一个token会attend到所有的token。)*来构建整个模型,因此最终生成**能融合左右上下文信息**的深层双向语言表征。
以往的预训练模型的结构会受到单向语言模型(*从左到右或者从右到左*的限制,因而也限制了模型的表征能力,使其只能获取单方向的上下文信息。而BERT利用MLM进行预训练并且采用深层的双向Transformer组件(*单向的Transformer一般被称为Transformer decoder,其每一个token(符号)只会attend到目前往左的token。而双向的Transformer则被称为Transformer encoder,其每一个token会attend到所有的token*来构建整个模型,因此最终生成**能融合左右上下文信息**的深层双向语言表征。
我们为了用户可以使用OneFlow-Libai快速验证Bert模型预训练,统计性能或验证精度,提供了一个Bert网络示例,主要网络参数如下:
......@@ -15,7 +15,7 @@ model.cfg.hidden_layers = 8
完整的Bert-Large网络配置在configs/common/model/bert.py中
## 数据集
我们在libai目录下集成了部分小数据集供用户快速验证:
我们在libai目录下集成了部分小数据集供用户快速验证,路径为
./nlp_data
## Bert预训练
......@@ -62,7 +62,10 @@ train.dist.pipeline_parallel_size = 1
| :--: | :--------: | :----------------------------------------------------------: |
| 4 | Libai-main | total_loss: 6.555 lm_loss: 5.973 sop_loss: 0.583/10000 iters |
## 历史版本
* https://developer.hpccube.com/codes/modelzoo/bert-large_oneflow
## 参考
* https://libai.readthedocs.io/en/latest/tutorials/get_started/quick_run.html
* https://github.com/Oneflow-Inc/oneflow
* https://github.com/Oneflow-Inc/libai/blob/main/docs/source/notes/FAQ.md
\ No newline at end of file
* https://github.com/Oneflow-Inc/libai/blob/main/docs/source/notes/FAQ.md
# 模型名称
modelName=Bert-Large
modelName=Bert-Large_OneFlow
# 模型描述
modelDescription=Bert-Large
modelDescription=基于OneFlow框架的Bert-Large模型
# 应用场景(多个标签以英文逗号分割)
appScenario=智能聊天助手
appScenario=NLP,智能聊天助手
# 框架类型(多个标签以英文逗号分割)
frameType=OneFlow,Libai
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment