kyzhouhzau / BERT-NER

Use Google's BERT for named entity recognition (CoNLL-2003 as the dataset).
MIT License
1.23k stars 335 forks source link

How can I add LSTM before CRF layer #77

Open zwd13122889 opened 4 years ago

azmat21 commented 4 years ago

you add LSTM in hidden2tag function, then both crf and softmax can use it

def hidden2tag(hiddenlayer,numclass):
    bi = tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(100, return_sequences=True))
    linear = tf.keras.layers.Dense(numclass,activation=None)
    hiddenlayer = bi(hiddenlayer)
    hiddenlayer = linear(hiddenlayer)
    return hiddenlayer
zwd13122889 commented 4 years ago

thank you . In my data , i hava 80 categories , the FBI = 55. How can i improve my accuracy ?