rikdz / GraphWriter

Code for "Text Generation from Knowledge Graphs with Graph Transformers"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Doesn't Reproduce Results from the Paper

HadiZayer opened this issue · comments

I tried to run the code and enabled the options like it was described in the paper and ran the model with the title encoding (with and without elmo) and the results weren't as good as the ones shown in the paper. The outputs showed word repetition and faulty grammar. What does need to be changed to match the results in the paper?

Hello,

    I am also running this code but have one issue with pytorch 1.1.0, and latest torchtext,  and I have one issue with "RawField object has no attribute of 'is_target'". Did you have this issue? If so, how do you solve it? Thank you!

Hello,

    I am also running this code but have one issue with pytorch 1.1.0, and latest torchtext,  and I have one issue with "RawField object has no attribute of 'is_target'". Did you have this issue? If so, how do you solve it? Thank you!

In lastDataset.py, after an assignment of a field to data.RawField(), you need set the is_target attribute to be false.
For example:
after ds.fields["rawent"] = data.RawField(), add another line with ds.fields["rawent"].is_target = False

Oh, got it! Many thanks for your help!

In lastDataset.py there is a line ds.getBatch(). But 'dataset' object has no attribute 'getBatch'. How did you solve this?

我运行出来也是有重复词和语法问题,请问这是为什么啊

Could anyone please tell me how to test the model after training? Many thanks.

commented
commented

Regarding "Q1: In pargs.py , what are the meaning of parameters "args.sparse" and "args.plan" in pargs.py? What means when they are True?"
args.plan indicates a plan-and-write style model that I have not finished developing yet. args.sparse is a sparse graph transformer that is also not yet developed. Please leave these flags to false.

Regarding """Q2: In the "preprocess*tsv" , what does the final part of one example mean? For example, in the following example, what does the sequence "2 14 7 22 27 18 -1 15 5 8 18 -1 3 0 10 26 18 -1 1 11 20 21 18 -1 6 13 23 18 -1 18 -1 4 9 19 24 25 18 -1" represent?"""
This is used for the plan-and-write model. Please ignore this part of the input.

I have updated the repository and others have that they can reproduce the paper results with the current codebase. Please reopen if problem persists.

Hello. I train the model and generate the train dataset results. It works well. However, when I ran the command "python generator.py -data=preprocessed.test.tsv -save=saved_models/19.vloss-3.570731.lr-0.1 ". It came out the follwing error:

Traceback (most recent call last):
File "generator.py", line 71, in
m.load_state_dict(cpt)
File "/home/desmon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 839, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for model:
size mismatch for emb.weight: copying a param with shape torch.Size([11738, 500]) from checkpoint, the shape in current model is torch.Size([1914, 500]).
size mismatch for out.weight: copying a param with shape torch.Size([11738, 1000]) from checkpoint, the shape in current model is torch.Size([1914, 1000]).
size mismatch for out.bias: copying a param with shape torch.Size([11738]) from checkpoint, the shape in current model is torch.Size([1914]).
size mismatch for le.seqenc.lemb.weight: copying a param with shape torch.Size([53343, 500]) from checkpoint, the shape in current model is torch.Size([6173, 500]).

It seems that the model size doesn't fit. However, I didn't change any part of the codes. Can anyone tell me how to fix it?

commented

Ok. I know it. Thank you!

I try to reproduce the experiment results of the paper using the original settings in the codebase. But the outputs seems not good. Or has anyone reproduced the results from the paper? Could you tell me the corresponding paramter settings? Thanks!

This is the test set results I ran:
Bleu_1: 22.002345819897354
Bleu_2: 12.539165110352608
Bleu_3: 7.4823137365735235
Bleu_4: 4.562304118176371
METEOR: 8.151402224569598
ROUGE_L: 16.02610836089507

@DesmonDay

I haved reproduced the experiment result of this paper using the original dataset and settings. And I got same score as the paper. According to my test, you may need to modify generate.py to generate candidate.dat and refrence.dat, and then use eval.py to evaluate BLEU and METEOR

Can anyone provide complete commands so that I can reproduce the same result as the paper? Thanks!

hello, in the lastDataset.py, the source code generate the vocab from training data, but when you run generate.py it generate vocab from test data, the vocab size is changed. I think we should change the path when you run generate.py . hahaha 

------------------ 原始邮件 ------------------ 发件人: "SiMing Dai"<notifications@github.com>; 发送时间: 2019年11月14日(星期四) 中午11:06 收件人: "rikdz/GraphWriter"<GraphWriter@noreply.github.com>; 抄送: "1501180796"<1501180796@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [rikdz/GraphWriter] Code Doesn't Reproduce Results from the Paper (#1) Hello. I train the model and generate the train dataset results. It works well. However, when I ran the command "python generator.py -data=preprocessed.test.tsv -save=saved_models/19.vloss-3.570731.lr-0.1 ". It came out the follwing error: Traceback (most recent call last): File "generator.py", line 71, in m.load_state_dict(cpt) File "/home/desmon/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 839, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for model: size mismatch for emb.weight: copying a param with shape torch.Size([11738, 500]) from checkpoint, the shape in current model is torch.Size([1914, 500]). size mismatch for out.weight: copying a param with shape torch.Size([11738, 1000]) from checkpoint, the shape in current model is torch.Size([1914, 1000]). size mismatch for out.bias: copying a param with shape torch.Size([11738]) from checkpoint, the shape in current model is torch.Size([1914]). size mismatch for le.seqenc.lemb.weight: copying a param with shape torch.Size([53343, 500]) from checkpoint, the shape in current model is torch.Size([6173, 500]). It seems that the model size doesn't fit. However, I didn't change any part of the codes. Can anyone tell me how to fix it? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi, can you please clarify this? I have changed the path, but still getting the mismatch error. What path do you mean exactly. Can you give a snippet of the code that you changed to get it to work?