macanv / BERT-BiLSTM-CRF-NER

Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tuning And private Server services
https://github.com/macanv/BERT-BiLSMT-CRF-NER
4.68k stars 1.25k forks source link

做fine-tuning,如果冻结bert层,只训练bilstm-crf层的参数应该怎么做 #314

Open struggling2life opened 4 years ago

struggling2life commented 4 years ago

您好,麻烦请问一下如果我想只训练bert层后面接的bilstm-crf层,训练中应该怎么冻结bert层的参数呢?

lowsa commented 4 years ago

遍历bert中的变量,将所有变量的requires_grad置为False