Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
run_train_lstm.sh | 4 years ago | |
task_lstm.py | 4 years ago | |
task_student_kd_lstm.py | 4 years ago |
"Distilling task-specific knowledge from bert into simple neural networks"论文的实现
Distilled BiLSTM的教师模型采用微调过的BERT,学生模型采用简单神经网络LSTM。
蒸馏的目标是KD loss,即仅使用软标签进行蒸馏,将BERT中的知识蒸馏到LSTM中。
完整的环境可以通过以下命令安装:
conda create -n tinybert python=3.6
python3 -m pip install --find-links https://oneflow-inc.github.io/nightly oneflow_cu101 --user
注:以下操作时,根目录为
model_compress/distil
如何获取数据请查阅这里
如何微调教师模型请查阅这里
执行以下脚本将教师模型蒸馏到学生模型:
最大序列长度为32,词表大小为10000
bash run_train_student_distilled_lstm.sh
蒸馏过的学生模型下载链接如下(SST-2数据集):
下载链接: https://pan.baidu.com/s/1M4XzB2DnLikglxVFvhnYpw 提取码: hqhj
执行以下脚本进行测试:
bash run_eval_student_distilled_lstm.sh
在SST-2 DEV数据集上:
一站式算法开发平台、高性能分布式深度学习框架、先进算法模型库、视觉模型炼知平台、数据可视化分析平台等一系列平台及工具,在模型高效分布式训练、数据处理和可视分析、模型炼知和轻量化等技术上形成独特优势,目前已在产学研等各领域近千家单位及个人提供AI应用赋能
Java Vue Python Text JavaScript other