DeepKE icon indicating copy to clipboard operation
DeepKE copied to clipboard

训练NER时出现key error

Open Mosquito0352 opened this issue 4 years ago • 2 comments

Traceback (most recent call last): File "D:/pythonProject/DeepKE/example/ner/standard/run_bert.py", line 179, in main eval_features = convert_examples_to_features(eval_examples, label_list, cfg.max_seq_length, tokenizer) File "D:\Anaconda\envs\deepke\lib\site-packages\deepke\name_entity_re\standard\tools\preprocess.py", line 92, in convert_examples_to_features label_ids.append(label_map[labels[i]]) KeyError: ''

Mosquito0352 avatar Sep 08 '22 04:09 Mosquito0352

有修改代码吗,还有使用的是哪个数据集

tlk1997 avatar Sep 08 '22 06:09 tlk1997

出现keyerror很有可能是数据集编码问题,我使用过程中数据集编码utf-8-sig就出现了keyerror问题,简单修改一下就可以

Zhangzhaoxin123 avatar Sep 13 '22 02:09 Zhangzhaoxin123