kyzhouhzau / BERT-NER

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

Question: size of logits #4

Open AaronWhite95 opened 5 years ago

AaronWhite95 commented 5 years ago

hi kyzhouhzau~

thank you for this project I have a question about the size of num_labels in BERT_NER.py line470. https://github.com/kyzhouhzau/BERT-NER/blob/2a9fcb8f857e9ac0bbd166437a4c9fe7bbc7d0c3/BERT_NER.py#L470

why you let the size of logits one bigger than the size of label_list? thank you so much!

kyzhouhzau commented 5 years ago

@HWZX Because I encode the label beginning from one, but I used 0 to padding the length. Here I did not use the masking method to calculate the loss, so zero is another label. But in the final evaluation of the result macro-f did not count the padding part.