基于DeBERTaV2的中文Lite预训练模型介绍(文档更新中)
DeBERTaV2的中文Lite预训练模型是使用wikipedia数据集、wudao数据集及中文网页数据,以masked language model任务训练的中文自然语言理解预训练模型。
模型描述
DeBERTaV2在BERT/RoBERTa的基础之上,通过解耦注意力机制、增强的掩码解码机制等方面进行改进,从而更好的对语言理解任务进行建模。详见论文Deberta: Decoding-enhanced bert with disentangled attention,主要改进点如下:
- 解耦注意力机制:在通用Transformer自注意力机制基础之上,将每个token的编码解耦为内容编码(content embedding)和位置编码(position embbeding),并通过两者的cross attention进行建模
- 增强的掩码解码机制:MLM任务预训练中在softmax层之前加入专门的解码层,并在解码层中引入绝对位置信息辅助MLM任务训练
- nGram Induced Input Encoding:在输入层增加char级别的卷积层,以进一步丰富输入token的相信信息
- 128K vocabulary:结合训练数据,通过中文分词及SentencePiece,构建了包含128K个词语的词典
本模型为Lite规模(Layer-6 / Hidden-768 / Head-12),参数规模约为137M。
期望模型使用方式以及适用范围
本模型主要用于中文相关下游任务微调。用户可以基于自有训练数据进行微调,具体微调训练方式请参考文档。
如何使用
在安装完成ModelScope-lib之后即可基于nlpdebertav2fill-mask_chinese-lite进行下游任务finetune
代码范例
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
ori_text = '你师父差得动你,你师父可差不动我。'
test_input = '你师父差得动你,你师父可[MASK]不动我。'
pipeline_ins = pipeline(
task=Tasks.fill_mask, model='damo/nlp_debertav2_fill-mask_chinese-lite')
print(f'\nori_text: {ori_text}\ninput: {test_input}\npipeline: '
f'{pipeline_ins(test_input)}\n')
模型局限性以及可能的偏差
基于中文数据进行训练,模型训练数据有限,效果可能存在一定偏差。
训练数据介绍
数据来源于维基数据、WuDao数据和中文网页数据等
模型训练流程
在中文wiki等无监督数据上,通过MLM任务训练得到。
数据评估及结果
暂无
相关论文以及引用信息
@article{he2020deberta,
title={Deberta: Decoding-enhanced bert with disentangled attention},
author={He, Pengcheng and Liu, Xiaodong and Gao, Jianfeng and Chen, Weizhu},
journal={arXiv preprint arXiv:2006.03654},
year={2020}
}
评论