GraphWriter icon indicating copy to clipboard operation
GraphWriter copied to clipboard

Some ERROR in the period of running the code

Open 15071347094 opened this issue 5 years ago • 24 comments

Hello, I just reproduced your code from the author. During the reproduction process, many problems occurred and the program could not run. The problems that occur during operation are shown in the following content: (myconda) root@844b4bd8212f:/mnt/GraphWriter/GraphWriter-master# python generator.py -save SAVED_MODEL Loading Data from data/preprocessed.train.tsv building vocab done Vocab sizes: src 6343 ent 53343 nerd 8 rel 17 out 11738 graph Traceback (most recent call last): File "generator.py", line 70, in cpt = torch.load(args.save) File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/serialization.py", line 419, in load f = open(f, 'rb') IsADirectoryError: [Errno 21] Is a directory: 'SAVED_MODEL'

If there is a problem with the Linux command, then if the code is run according to the corresponding directory, the following problems will still occur: (myconda) root@844b4bd8212f:/mnt/GraphWriter/GraphWriter-master# python generator.py -save=DIR/0.vloss-4.166054.lr-0.1 Loading Data from data/preprocessed.train.tsv building vocab done Vocab sizes: src 6343 ent 53343 nerd 8 rel 17 out 11738 graph Traceback (most recent call last): File "generator.py", line 79, in preds,gold = test(args,ds,m) File "generator.py", line 28, in test pf = open(ofn,'w') FileNotFoundError: [Errno 2] No such file or directory: '../outputs/0.vloss-4.166054.lr-0.1.inputs.beam_predictions.cmdline'

However, there is no relevant folder in the file you gave. Even after I created the corresponding folder, there will still be related problems, so I would like to ask you and relevant persons how to solve this problem. Thank you very much.

15071347094 avatar Apr 17 '20 09:04 15071347094

I think if you change line 27 of generator to be a more appropriate filename it will work. I will clean up this part of the code ASAP. Thanks!

rikdz avatar Apr 17 '20 15:04 rikdz

@rikdz Thank you very much for your timely help. But there are still problems in the process of running eval.py. I don't know if I need to install other environments or components. The specific issues are as follows: File "eval.py", line 92, in x = Evaluate() File "eval.py", line 16, in init (Meteor(), "METEOR"), File "/mnt/GraphWriter/GraphWriter-master/pycocoevalcap/meteor/meteor.py", line 20, in init stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, bufsize=1) File "/root/miniconda3/envs/myconda/lib/python3.7/subprocess.py", line 800, in init restore_signals, start_new_session) File "/root/miniconda3/envs/myconda/lib/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'java': 'java' Exception ignored in: <function Meteor.del at 0x7f149893a290> Traceback (most recent call last): File "/mnt/GraphWriter/GraphWriter-master/pycocoevalcap/meteor/meteor.py", line 59, in del self.lock.acquire() AttributeError: 'Meteor' object has no attribute 'lock' But when I install the 'lock' attribute, it still displays an error, I do not know where the problem is, so I would like to ask you how to solve it. Thank you!

15071347094 avatar Apr 18 '20 03:04 15071347094

meteor need jave environment

wutaiqiang avatar Apr 18 '20 08:04 wutaiqiang

@wutaiqiang OK ,Thank you very much. After installing JAVA, do I need to configure other environments?

15071347094 avatar Apr 18 '20 08:04 15071347094

maybe not,i use other lib to get the score,https://github.com/Maluuba/nlg-eval

wutaiqiang avatar Apr 18 '20 12:04 wutaiqiang

@wutaiqiang Thank you very much for your kind help, I will have a try.

15071347094 avatar Apr 18 '20 13:04 15071347094

@rikdz @wutaiqiang Thank you very much for your previous help. After installing Java, I ran the eval.py file again, but there were still problems: Traceback (most recent call last): File "eval.py", line 102, in x.evaluate(live=True, cand=cands, ref=refs) File "eval.py", line 67, in evaluate final_scores = self.score(ref, hypo) File "eval.py", line 34, in score score, scores = scorer.compute_score(ref, hypo) File "D:\CCNU\Pycharm\import4\GraphWriter-master\pycocoevalcap\meteor\meteor.py", line 36, in compute_score hypothesis_str = res[i][0].replace('|||', '').replace(' ', ' ') TypeError: a bytes-like object is required, not 'str' But I also searched for many solutions, but it still doesn't work. I want to find out whether the problem is caused by the code itself or if my environment configuration needs improvement. Looking forward to your reply and everyone's suggestions. Thank you very much。

15071347094 avatar Apr 20 '20 10:04 15071347094

@15071347094 i think this is because the encoding way for txt,the txt file is encoding by UTF-8 and you should transfer the encoding way to ANSI【记事本打开,另存为txt,可以选择ansi选项,然后应该就可以了】

wutaiqiang avatar Apr 20 '20 10:04 wutaiqiang

@15071347094 I had this error when I tried to run the code with python3. Using python2 worked for me. Maybe this is your problem, too?

mnschmit avatar Apr 20 '20 10:04 mnschmit

python 2 and python 3 is different in handling the utf-8 encode txt

wutaiqiang avatar Apr 20 '20 10:04 wutaiqiang

@wutaiqiang @mnschmit Thank you very much for your sincere help, I just saw your reply. In terms of environment, I use python3.7, but if I choose to switch to python2, I may have to configure many environments, so if I change the file format, I am directly modifying the suffix names of the two files to be compared ?

15071347094 avatar Apr 20 '20 11:04 15071347094

if you have changed the file format,just use the file

wutaiqiang avatar Apr 20 '20 11:04 wutaiqiang

@wutaiqiang Thank you very much, I will have a try.

15071347094 avatar Apr 20 '20 11:04 15071347094

@wutaiqiang Thank you for the method thta you provided, but according to your prompt, after changing the file to a text file, the previous problem will still occur when running the program. The following is the specific error message: D:\CCNU\Pycharm\import4\GraphWriter-master>python eval.py 0.vloss-4.254202.lr-0.1cmdline.txt data\preprocessed1.test.txt Traceback (most recent call last): File "eval.py", line 102, in x.evaluate(live=True, cand=cands, ref=refs) File "eval.py", line 67, in evaluate final_scores = self.score(ref, hypo) File "eval.py", line 34, in score score, scores = scorer.compute_score(ref, hypo) File "D:\CCNU\Pycharm\import4\GraphWriter-master\pycocoevalcap\meteor\meteor.py", line 36, in compute_score hypothesis_str = res[i][0].replace('|||', '').replace(' ', ' ') TypeError: a bytes-like object is required, not 'str' I don't know if there is a way to solve this kind of problem, I look forward to your reply. thank you very much.

15071347094 avatar Apr 20 '20 11:04 15071347094

hard to believe , i use the repo https://github.com/Maluuba/nlg-eval and save the grouth as txt , finally i use the ref.txt and groundtruth.txt to get the score ,both txt need to be tranfered

wutaiqiang avatar Apr 20 '20 13:04 wutaiqiang

@wutaiqiang Thank you very much for your kind help. I want to ask if the repo you provided is the same as the author's data environment. In addition, I used python2 to run the program before and found it impossible. It was later discovered that python2 officially ceased operations on January 1 this year. So now I can only use python3 to run the program. Finally, I really appreciate your patience and guidance.

15071347094 avatar Apr 20 '20 13:04 15071347094

maybe the repo and code from author, i have not compare them, happy to hear that it works

wutaiqiang avatar Apr 20 '20 13:04 wutaiqiang

OK,I will have a try------------------ 原始邮件 ------------------ 发件人: "wutaiqiang"[email protected] 发送时间: 2020年4月20日(星期一) 晚上9:56 收件人: "rikdz/GraphWriter"[email protected]; 抄送: "Anderson"[email protected];"Mention"[email protected]; 主题: Re: [rikdz/GraphWriter] Some ERROR in the period of running the code(#18)

maybe the repo and code from author, i have not compare them, happy to hear that it works

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

15071347094 avatar Apr 20 '20 14:04 15071347094

@rikdz @wutaiqiang @mnschmit Thank you very much for your previous help. By running related programs, I found that some data results are a bit different from those in the paper. The following is the result of running on my own computer: Bleu_1: 20.947767 Bleu_2: 10.841722 Bleu_3: 6.3299582 Bleu_4: 3.8990213 RPUGE_L: 14.630650

But the result in the paper is: Bleu:14.3 So I want to ask what is the reason to cause this result. Thank you very much!

15071347094 avatar Apr 21 '20 10:04 15071347094

@wutaiqiang @rikdz I'm sorry to disturb you, but what I want to confirm is that the result of the BLEU value in the paper is the average of the results of BLEU-1, BLEU-2, BLEU-3, and BLEU-4? Or taking the weighted average result, I want to confirm this, thank you very much

15071347094 avatar Apr 22 '20 02:04 15071347094

@15071347094 i think it is the BLEU-4 score

wutaiqiang avatar Apr 22 '20 03:04 wutaiqiang

@wutaiqiang Thank you very much for your kind help. But the following explanation appeared in the original paper: “To verify the performance gap between GraphWriter and GAT, we report the average test metrics for 4 training runs of each model along with their variances” Does this mean that the final selection of the paper is the average of BLEU 1-4. Looking forward to your reply. Thank you!

15071347094 avatar Apr 22 '20 03:04 15071347094

it means that author did the experiment for 4 times and get the mean of BLEU-4 score

wutaiqiang avatar Apr 22 '20 07:04 wutaiqiang

@wutaiqiang OK,Thank you very much for your kind help.

15071347094 avatar Apr 22 '20 07:04 15071347094