yuanxiaosc/Entity-Relation-Extraction

运行run_predicate_classification.py训练脚本报错,能帮忙看看嘛?

Closed this issue · 2 comments

tanzf commented

Traceback (most recent call last):
File "run_predicate_classification.py", line 812, in
tf.app.run()
File "/home/anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "run_predicate_classification.py", line 690, in main
train_examples, label_list, FLAGS.max_seq_length, tokenizer, train_file)
File "run_predicate_classification.py", line 381, in file_based_convert_examples_to_features
max_seq_length, tokenizer)
File "run_predicate_classification.py", line 343, in convert_single_example
label_ids = _predicate_label_to_id(label_list, label_map)
File "run_predicate_classification.py", line 367, in _predicate_label_to_id
predicate_label_ids[predicate_label_map[label]] = 1
KeyError: ''

@tanzf 这个报错表示再把关系标签转换成数字的时候发生错误,你尝试改下def _predicate_label_to_id(predicate_label, predicate_label_map): 这个转换函数世事

tanzf commented

好的,谢谢,已经解决