赞
踩
代码版本: brightmart/albert_zh
修改modeling.py
的BertModel
类,在pooler
层后添加卷积层。
运行run_pretraining.py
文件,读取albert_tiny_zh
的预训练权重继续训练,运行失败,提示下面这段话,意思是缺少某些预训练权重,也就是需要我所添加的层在ckpt文件中存在。
tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint.
尝试为原始ckpt文件添加新权重,未找到现成可运行代码或操作提示,GPT提供的代码也是各种报错,未成功。
此时,运行run_classifier.py
文件,调用修改过的modeling.py
,获得新的ckpt权重文件,再去运行run_pretraining.py
文件就可以了。
run_classifier.py
文件用来对下游任务进行微调,run_pretraining.py
文件用来进行预训练,只需要先微调得到完整的权重就可以来预训练啦,不太明白微调怎么不用ckpt文件包含全部参数,但是预训练需要所有参数,不合理但可行!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。