Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行semeval数据集时报错 #11

Open
ghost opened this issue May 6, 2022 · 20 comments
Open

运行semeval数据集时报错 #11

ghost opened this issue May 6, 2022 · 20 comments

Comments

@ghost
Copy link

ghost commented May 6, 2022

在windows系统下运行本程序,通过pycharm传递参数。
运行sample无误,但是通过preprocess_dependency.py文件完成对semeval数据集的处理。随后运行re_agcn_main.py文件。在运行convert_examples_to_features方法时,第二次循环会报错。具体如下:
Traceback (most recent call last):
File "F:/undergranduate/NLP/relation extraction/RE-AGCN/RE-AGCN-main/re_agcn_main.py", line 436, in
main()
File "F:/undergranduate/NLP/relation extraction/RE-AGCN/RE-AGCN-main/re_agcn_main.py", line 429, in main
train_func(args)
File "F:/undergranduate/NLP/relation extraction/RE-AGCN/RE-AGCN-main/re_agcn_main.py", line 405, in train_func
train(args, model, tokenizer, processor, device, args.n_gpu)
File "F:/undergranduate/NLP/relation extraction/RE-AGCN/RE-AGCN-main/re_agcn_main.py", line 123, in train
train_data = processor.build_dataset(train_examples, tokenizer, args.max_seq_length, "train", args)
File "F:\undergranduate\NLP\relation extraction\RE-AGCN\RE-AGCN-main\data_utils.py", line 335, in build_dataset
features = self.convert_examples_to_features(examples, tokenizer, max_seq_length)
File "F:\undergranduate\NLP\relation extraction\RE-AGCN\RE-AGCN-main\data_utils.py", line 302, in convert_examples_to_features
label_id = label_map[example["label"]]
KeyError: 'Other'
并未更改程序内任何部分。python为3.7.10,pytorch为1.8.0。希望能够获得回答。谢谢。

@ghost
Copy link
Author

ghost commented May 6, 2022

实测,报错原因为标签不完全一致,具体为other的首字母大小写区别。preprocess_dependency.py文件处理semeval数据时所产生的label.json文件中的other中的“o”为小写,但是程序运行过程中所产生的标签为Other,为大写“O”,因此无法匹配造成报错。

@dymyyc
Copy link

dymyyc commented May 10, 2022

请问下,在处理semeval数据集时,您有自己生成.tsv文件吗?

@ghost
Copy link
Author

ghost commented May 10, 2022

请问下,在处理semeval数据集时,您有自己生成.tsv文件吗?

没有生成tsv文件。改了一下preprocess_dependency.py文件里的就可以跑通。另外此程序运行时需要dev参与,但是semeval并不提供dev。

@dymyyc
Copy link

dymyyc commented May 10, 2022 via email

@ghost
Copy link
Author

ghost commented May 10, 2022

截取了train中的一部分数据集充当dev

@dymyyc
Copy link

dymyyc commented May 10, 2022 via email

@ghost
Copy link
Author

ghost commented May 10, 2022

并未遇到该问题,可查看是否使用了与源代码中所需要的工具版本相同。

@dymyyc
Copy link

dymyyc commented May 10, 2022 via email

@ghost
Copy link
Author

ghost commented May 10, 2022

3.9.2

@dymyyc
Copy link

dymyyc commented May 10, 2022 via email

@dymyyc
Copy link

dymyyc commented May 12, 2022 via email

@ghost
Copy link
Author

ghost commented May 12, 2022

重写了指标函数

@dymyyc
Copy link

dymyyc commented Jun 7, 2022 via email

@hhn0724
Copy link

hhn0724 commented Jun 10, 2022

我复现后的P,R,F1都为0,请问里面有什么讲究吗?

---原始邮件--- 发件人: @.> 发送时间: 2022年5月10日(周二) 晚上10:37 收件人: @.>; 抄送: @.@.>; 主题: Re: [cuhksz-nlp/RE-AGCN] 运行semeval数据集时报错 (Issue #11) 3.9.2 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

您好,请问解决了吗?我重写指标函数后训练,第一个epoch之后几十个epochF值一直是0.16没变

@hhn0724
Copy link

hhn0724 commented Jun 10, 2022

并未遇到该问题,可查看是否使用了与源代码中所需要的工具版本相同。
您好,请问您在semeval上训练结果怎么样啊?我调通代码后,训练20个epoch,从第一个epoch后,F值一直没变,一直0.16

@hhn0724
Copy link

hhn0724 commented Jul 13, 2022

您好,原论文使用的指标函数也是正确的,是我使用方法不对,这里也谢谢您的答复! 发件人: @.> 发送时间: 2022年5月12日(周四) 晚上10:01 收件人: @.>; 抄送: @.@.>; 主题: Re: [cuhksz-nlp/RE-AGCN] 运行semeval数据集时报错 (Issue #11) 重写了指标函数 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
那请问您是怎么解决的?我这指标也是0.

@ghost
Copy link
Author

ghost commented Oct 11, 2022 via email

@dymyyc
Copy link

dymyyc commented Oct 11, 2022 via email

@dymyyc
Copy link

dymyyc commented Oct 11, 2022 via email

@dymyyc
Copy link

dymyyc commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants