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

Key Error on NER example #64

Open imsazzad opened 5 years ago

imsazzad commented 5 years ago

Traceback (most recent call last): File "BERT_NER.py", line 699, in tf.app.run() File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run _run_main(main, args) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "BERT_NER.py", line 618, in main train_examples, label_list, FLAGS.max_seq_length, tokenizer, train_file) File "BERT_NER.py", line 328, in filed_based_convert_examples_to_features feature,ntokens,label_ids = convert_single_example(ex_index, example, label_list, max_seq_length, tokenizer, mode) File "BERT_NER.py", line 285, in convert_single_example label_ids.append(label_map[labels[i]]) KeyError: 'MY_LABEL'

imsazzad commented 5 years ago

I found an almost similar issue in BERT repo, and someone from their original collaborator fixed the issue. did you consider that update LINK: https://github.com/google-research/bert/issues/80#issuecomment-436823886 @kyzhouhzau ?