stanleylsx / entity_extractor_by_ner

基于Tensorflow2.3开发的NER模型,都是CRF范式,包含Bilstm(IDCNN)-CRF、Bert-Bilstm(IDCNN)-CRF、Bert-CRF,可微调预训练模型,可对抗学习,用于命名实体识别,配置后可直接运行。
393 stars 74 forks source link

用了自己的标注数据集 结果报错 #39

Closed N1ckyyy closed 2 years ago

N1ckyyy commented 2 years ago

Traceback (most recent call last): File "D:/code/entity_extractor_by_ner-master/main.py", line 72, in train(configs, dataManager, logger) File "D:\code\entity_extractor_by_ner-master\engines\train.py", line 50, in train train_dataset, val_dataset = data_manager.get_training_set() File "D:\code\entity_extractor_by_ner-master\engines\data.py", line 249, in get_training_set df_train['label_id'] = df_train.label.map(lambda x: -1 if str(x) == str(np.nan) else self.label2id[x]) File "C:\ProgramData\Anaconda3\envs\entity_extractor_by_ner-master\lib\site-packages\pandas\core\series.py", line 3828, in map new_values = super()._map_values(arg, na_action=na_action) File "C:\ProgramData\Anaconda3\envs\entity_extractor_by_ner-master\lib\site-packages\pandas\core\base.py", line 1300, in _map_values new_values = map_f(values, mapper) File "pandas/_libs/lib.pyx", line 2228, in pandas._libs.lib.map_infer File "D:\code\entity_extractor_by_ner-master\engines\data.py", line 249, in df_train['label_id'] = df_train.label.map(lambda x: -1 if str(x) == str(np.nan) else self.label2id[x]) KeyError: 'B-EQ'

EQ是我自己的实体类别 system.config里已经修改suffix为我的实体类别了 但还是报错 是不是还有其他地方需要修改 谢谢

Okiii-lh commented 2 years ago

你好解决了吗

LakersUpAma commented 2 years ago

把label2id那两个文件删除。 请问你知道自己标注的训练集识别为0是啥情况吗。