# albert_zh
An Implementation of <a href="https://arxiv.org/pdf/1909.11942.pdf">A Lite Bert For Self-Supervised Learning Language Representations</a> with TensorFlow
ALBert is based on Bert, but with some improvements. It achieves state of the art performance on main benchmarks with 30% parameters less.
For albert_base_zh it only has ten percentage parameters compare of original bert model, and main accuracy is retained.
Different version of ALBERT pre-trained model for Chinese, including TensorFlow, PyTorch and Keras, is available now.
海量中文语料上预训练ALBERT模型:参数更少,效果更好。预训练小模型也能拿下13项NLP任务,ALBERT三大改造登顶GLUE基准
更多数据集、基线模型、不同任务上模型效果的详细对比,见<a href="https://github.com/chineseGLUE/chineseGLUE">中文任务基准测评chineseGLUE</a>
<img src="https://github.com/brightmart/albert_zh/blob/master/resources/albert_tiny_compare_s.jpg" width="90%" height="70%" />
模型下载 Download Pre-trained Models of Chinese
-----------------------------------------------
1、<a href="https://storage.googleapis.com/albert_zh/albert_tiny.zip">albert_tiny_zh</a>, <a href="https://storage.googleapis.com/albert_zh/albert_tiny_489k.zip">albert_tiny_zh(训练更久,累积学习20亿个样本)</a>,文件大小16M、参数为1.8M
训练和推理预测速度提升约10倍,精度基本保留,模型大小为bert的1/25;语义相似度数据集LCQMC测试集上达到85.4%,相比bert_base仅下降1.5个点。
lcqmc训练使用如下参数: --max_seq_length=128 --train_batch_size=64 --learning_rate=1e-4 --num_train_epochs=5
albert_tiny使用同样的大规模中文语料数据,层数仅为4层、hidden size等向量维度大幅减少; 尝试使用如下学习率来获得更好效果:{2e-5, 6e-5, 1e-4}
【使用场景】任务相对比较简单一些或实时性要求高的任务,如语义相似度等句子对任务、分类任务;比较难的任务如阅读理解等,可以使用其他大模型。
2、<a href="https://storage.googleapis.com/albert_zh/albert_large_zh.zip">albert_large_zh</a>,参数量,层数24,文件大小为64M
参数量和模型大小为bert_base的六分之一;在口语化描述相似性数据集LCQMC的测试集上相比bert_base上升0.2个点
3、<a href="https://storage.googleapis.com/albert_zh/albert_base_zh_additional_36k_steps.zip">albert_base_zh(额外训练了1.5亿个实例即 36k steps * batch_size 4096)</a>; <a href="https://storage.googleapis.com/albert_zh/albert_base_zh.zip"> albert_base_zh(小模型体验版)</a>, 参数量12M, 层数12,大小为40M
参数量为bert_base的十分之一,模型大小也十分之一;在口语化描述相似性数据集LCQMC的测试集上相比bert_base下降约0.6~1个点;
相比未预训练,albert_base提升14个点
4、<a href="https://storage.googleapis.com/albert_zh/albert_xlarge_zh_177k.zip">albert_xlarge_zh_177k </a>;
<a href="https://storage.googleapis.com/albert_zh/albert_xlarge_zh_183k.zip">albert_xlarge_zh_183k(优先尝试)</a>参数量,层数24,文件大小为230M
参数量和模型大小为bert_base的二分之一;需要一张大的显卡;完整测试对比将后续添加;batch_size不能太小,否则可能影响精度
Updates
-----------------------------------------------
**\*\*\*\*\* 2019-10-15: albert_tiny_zh, 10 times fast than bert base for training and inference, accuracy remains \*\*\*\*\***
**\*\*\*\*\* 2019-10-07: more models of albert \*\*\*\*\***
add albert_xlarge_zh; albert_base_zh_additional_steps, training with more instances
**\*\*\*\*\* 2019-10-04: PyTorch and Keras versions of albert were supported \*\*\*\*\***
a.Convert to PyTorch version and do your tasks through <a href="https://github.com/lonePatient/albert_pytorch">albert_pytorch</a>
b.Load pre-trained model with keras using one line of codes through <a href="https://github.com/bojone/bert4keras">bert4keras</a>
c.Use albert with TensorFlow 2.0: Use or load pre-trained model with tf2.0 through <a href="https://github.com/kpe/bert-for-tf2">bert-for-tf2</a>
Releasing albert_xlarge on 6th Oct
**\*\*\*\*\* 2019-10-02: albert_large_zh,albert_base_zh \*\*\*\*\***
Relesed albert_base_zh with only 10% parameters of bert_base, a small model(40M) & training can be very fast.
Relased albert_large_zh with only 16% parameters of bert_base(64M)
**\*\*\*\*\* 2019-09-28: codes and test functions \*\*\*\*\***
Add codes and test functions for three main changes of albert from bert
ALBERT模型介绍 Introduction of ALBERT
-----------------------------------------------
ALBERT模型是BERT的改进版,与最近其他State of the art的模型不同的是,这次是预训练小模型,效果更好、参数更少。
它对BERT进行了三个改造 Three main changes of ALBert from Bert:
1)词嵌入向量参数的因式分解 Factorized embedding parameterization
O(V * H) to O(V * E + E * H)
如以ALBert_xxlarge为例,V=30000, H=4096, E=128
那么原先参数为V * H= 30000 * 4096 = 1.23亿个参数,现在则为V * E + E * H = 30000*128+128*4096 = 384万 + 52万 = 436万,
词嵌入相关的参数变化前是变换后的28倍。
2)跨层参数共享 Cross-Layer Parameter Sharing
参数共享能显著减少参数。共享可以分为全连接层、注意力层的参数共享;注意力层的参数对效果的减弱影响小一点。
3)段落连续性任务 Inter-sentence coherence loss.
使用段落连续性任务。正例,使用从一个文档中连续的两个文本段落;负例,使用从一个文档中连续的两个文本段落,但位置调换了。
避免使用原有的NSP任务,原有的任务包含隐含了预测主题这类过于简单的任务。
We maintain that inter-sentence modeling is an important aspect of language understanding, but we propose a loss
based primarily on coherence. That is, for ALBERT, we use a sentence-order prediction (SOP) loss, which avoids topic
prediction and instead focuses on modeling inter-sentence coherence. The SOP loss uses as positive examples the
same technique as BERT (two consecutive segments from the same document), and as negative examples the same two
consecutive segments but with their order swapped. This forces the model to learn finer-grained distinctions about
discourse-level coherence properties.
其他变化,还有 Other changes:
1)去掉了dropout Remove dropout to enlarge capacity of model.
最大的模型,训练了1百万步后,还是没有过拟合训练数据。说明模型的容量还可以更大,就移除了dropout
(dropout可以认为是随机的去掉网络中的一部分,同时使网络变小一些)
We also note that, even after training for 1M steps, our largest models still do not overfit to their training data.
As a result, we decide to remove dropout to further increase our model capacity.
其他型号的模型,在我们的实现中我们还是会保留原始的dropout的比例,防止模型对训练数据的过拟合。
2)为加快训练速度,使用LAMB做为优化器 Use LAMB as optimizer, to train with big batch size
使用了大的batch_size来训练(4096)。 LAMB优化器使得我们可以训练,特别大的批次batch_size,如高达6万。
3)使用n-gram(uni-gram,bi-gram, tri-gram)来做遮蔽语言模型 Use n-gram as make language model
即以不同的概率使用n-gram,uni-gram的概率最大,bi-gram其次,tri-gram概率最小。
本项目中目前使用的是在中文上做whole word mask,稍后会更新一下与n-gram mask的效果对比。n-gram从spanBERT中来。
训练语料/训练配置 Training Data & Configuration
----
没有合适的资源?快使用搜索试试~ 我知道了~
汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip
共137个文件
py:71个
pyc:15个
md:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 15 浏览量
2024-01-27
23:26:59
上传
评论
收藏 2.72MB ZIP 举报
温馨提示
【资源说明】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 3、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip
资源推荐
资源详情
资源评论
收起资源包目录
汽车论坛消费者用车体验内容的判别与标注参赛源码+项目说明.zip (137个子文件)
submission_xlnet_v2.csv 136KB
submission_xlnet.csv 136KB
submission_xlnet_v1.csv 136KB
process_data.ipynb 25KB
ernie_process.ipynb 21KB
result_five_merge.ipynb 11KB
results_tree_merge.ipynb 8KB
analysis.ipynb 6KB
probabilities_merge.ipynb 4KB
albert_large_zh_parameters.jpg 211KB
state_of_the_art.jpg 118KB
albert_performance.jpg 118KB
add_data_removing_dropout.jpg 96KB
albert_configuration.jpg 90KB
xlarge_loss.jpg 81KB
albert_tiny_compare_s_old.jpg 63KB
crmc2018_compare_s.jpg 62KB
albert_tiny_compare_s.jpg 47KB
albert_config_xxlarge.json 564B
albert_config_xlarge.json 563B
albert_config_large.json 563B
albert_config_base.json 563B
albert_config_tiny.json 562B
bert_config.json 518B
LICENSE 11KB
README.md 21KB
README.md 14KB
README_EN.md 11KB
README.md 4KB
README.md 3KB
README.md 2KB
README.md 1KB
README.md 1KB
README.md 878B
README.md 191B
README.md 151B
spiece.model 675KB
tpu_estimator.py 136KB
modeling.py 69KB
modeling.py 49KB
run_squad.py 45KB
run_cmrc_drcd.py 44KB
create_pretraining_data.py 43KB
run_classifier.py 38KB
modeling.py 37KB
utils_sequence_level_task.py 31KB
utils_sequence_level_task.py 30KB
data_utils.py 29KB
modeling.py 28KB
create_pretraining_data_roberta.py 26KB
run_pre_train.py 23KB
run_classifier.py 22KB
run_sequence_level_classification.py 21KB
run_token_level_classification.py 20KB
run_pretraining.py 19KB
run_sequence_level_classification.py 18KB
tokenization.py 18KB
run_pretraining.py 18KB
utils_token_level_task.py 18KB
create_pre_train_data.py 18KB
run_classifier.py 16KB
create_pretraining_data.py 15KB
run_news_sentiment.py 14KB
model_utils.py 14KB
extract_features.py 14KB
tokenization.py 13KB
optimization.py 13KB
tokenization.py 12KB
function_builder.py 12KB
squad_utils.py 12KB
Processor.py 12KB
optimization.py 12KB
similarity.py 11KB
xlnet.py 10KB
file_utils.py 9KB
tf_metrics.py 8KB
train_eval.py 6KB
optimization_finetuning.py 6KB
optimization.py 6KB
bert_utils.py 4KB
prepro_utils.py 4KB
classifier_utils.py 4KB
cmrc2018_evaluate_drcd.py 4KB
summary.py 4KB
bert_DPCNN.py 4KB
utils.py 3KB
test_changes.py 3KB
bert_CNN.py 3KB
bert_RCNN.py 3KB
Processor.py 3KB
bert_RNN.py 3KB
freeze_model.py 3KB
gpu_utils.py 2KB
ERNIE.py 2KB
bert.py 2KB
ngram_utils.py 2KB
sql_txt_for_sentiment_bert.py 2KB
run.py 2KB
setup.py 1KB
args.py 929B
共 137 条
- 1
- 2
资源评论
土豆片片
- 粉丝: 1567
- 资源: 5643
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功