• Stars
    star
    308
  • Rank 134,897 (Top 3 %)
  • Language
    Python
  • Created about 5 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

BERT distillation(基于BERT的蒸馏实验 )

基于BERT的蒸馏实验

参考论文《Distilling Task-Specific Knowledge from BERT into Simple Neural Networks》

分别采用keras和pytorch基于textcnn和bilstm(gru)进行了实验

实验数据分割成 1(有标签训练):8(无标签训练):1(测试)

在情感2分类clothing的数据集上初步结果如下:

  • 小模型(textcnn & bilstm)准确率在 0.80 ~ 0.81

  • BERT模型 准确率在 0.90 ~ 0.91

  • 蒸馏模型 准确率在 0.87 ~ 0.88

实验结果与论文结论基本一致,与预期相符

后续将尝试其他更有效的蒸馏方案

使用方法

首先finetune BERT

python ptbert.py

然后把BERT的知识蒸馏到小模型里

需要先解压data/cache/word2vec.gz

然后

python distill.py

调整文件中的use_aug及以下的参数可以使用论文中提到的其中两种数据增强方式(masking, n-gram sampling)

More Repositories

1

NLP_summary

自然语言处理
Python
93
star
2

competition_tianchi

阿里移动推荐算法比赛
Python
72
star
3

tensor_tools

张量分解算法整理
MATLAB
58
star
4

DeepDive_Chinese

DeepDive 中文配置
XSLT
51
star
5

shanghai_transportation

上海市交通流量时空模式挖掘
Python
51
star
6

poincare_embedding

Poincaré Embedding
Python
40
star
7

hangzhou_SSTD

杭州市群体驻留时空模式挖掘
Python
19
star
8

terror_analysis

暴恐事件自动检测
Python
13
star
9

hangzhou_CCF

杭州市群体与区域移动行为时空模式挖掘
Python
12
star
10

thesis

城市群体驻留与交通流量时空模式研究
11
star
11

text_classification

keras implementation of text classification algorithms
Python
11
star
12

bionics

仿生学算法实现
Python
10
star
13

shanghai_geographical_topics

上海市区域功能语义挖掘
Python
9
star
14

shanghai_cells

上海市网格数据时空模式挖掘
Python
7
star
15

P2P_evaluation

P2P借贷平台风险评估
Python
7
star
16

competition_math

遗传疾病位点与基因分析(2016全国数模比赛)
Python
7
star
17

jiebac

Use C++ API and Cython to speed up jieba 高效的中文分词库
C++
6
star
18

bio-research

生物文本信息挖掘
Python
6
star
19

hangzhou_zones

杭州市功能区域挖掘
Python
5
star
20

coding_exercise

Codility与Leetcode题解
Python
5
star
21

campus_wifi_onspark

校园网移动流量挖掘
Python
4
star
22

competition_EMC

EMC智慧校园数据比赛
HTML
4
star
23

review_open_IE

用户评论开放域信息抽取
Python
3
star
24

learning_rnn

Keras RNN and LSTM
Python
2
star
25

bot_rl

reinforcement learning goal-oriented chatbot
Python
2
star
26

semi-supervied_learning

本监督代价敏感学习
Python
2
star
27

cs20

tensorflow learning
Python
1
star
28

hangzhou_crawler

杭州市多源信息采集
Python
1
star
29

python_black_magic

Python黑魔法:尾递归与Y组合子
Python
1
star
30

cs224

cs224 pytorch
Python
1
star