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.67k stars 1.25k forks source link

bert_base/train/bert_lstm_ner.py中450行附近没有文档说明中提到的add_blstm_crf_layer函数,这个文档就是bert_ner模型吧,没有用到bilstm 和crf吧? #362

Closed sxk000 closed 3 years ago

sxk000 commented 3 years ago

你好,首先感谢大佬分享!

我看程序说明文档有一段说:

USING BLSTM-CRF OR ONLY CRF FOR DECODE!

Just alter bert_lstm_ner.py line of 450, the params of the function of add_blstm_crf_layer: crf_only=True or False

ONLY CRF output layer:


    blstm_crf = BLSTM_CRF(embedded_chars=embedding, hidden_unit=FLAGS.lstm_size, cell_type=FLAGS.cell, num_layers=FLAGS.num_layers,
                          dropout_rate=FLAGS.droupout_rate, initializers=initializers, num_labels=num_labels,
                          seq_length=max_seq_length, labels=labels, lengths=lengths, is_training=is_training)
    rst = blstm_crf.add_blstm_crf_layer(crf_only=True)

bert_base/train/bert_lstm_ner.py中450行附近没有文档说明中提到的add_blstm_crf_layer函数,这个bert_lstm_ner.py文档就是bert_ner模型吧,没有用到bilstm 和crf吧?

如何在bert上加crf或者bilstm+crf呢?谢谢!

谢谢看到的大佬解惑!
df14jsj117 commented 3 years ago

我也没看懂这个crf_only是什么意思,楼主搞定了吗

sunGbemi commented 2 years ago

好像到models的101行