NingMiao / CGMH

Codes for <CGMH: Constrained Sentence Generation by Metropolis-Hastings Sampling>

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error to run key-gen

yuntang opened this issue · comments

I download the models and try to run text generation for key-gen task. The error I get is blow:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [50003] rhs shape= [30003]
[[Node: save/Assign_5 = Assign[T=DT_FLOAT, _class=["loc:@forward/softmax_b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](forward/softmax_b, save/RestoreV2_5)]]

Any idea? Thanks!
Yun

Sorry, I didn't run into this error during testing. Do any one else have the same problem?

I guess is the model I downloaded and the configure file doesn't match well.
I changed self.dict_size in config.py from 50000 to 30000 and the code generates sentence for key word "eat"
"moniker been 12 eat in the meeting Provisional Provisional Provisional"
I am not sure if that is good or bad.

However, it fails again for key words "weather like"
The error message is below:

InvalidArgumentError (see above for traceback): indices[0,1] = 50000 is not in [0, 30003)
[[Node: forward_test/forward/embedding_lookup = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@forward/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](forward/embedding/read, _arg_forward_test/forward/Placeholder_0_0)]]

I am sorry that I cannot reproduce your problem. The model provided in the repo is just for test. Maybe you should consider training a new better language model.

BTW, the GPT-2 version of CGMH is on the way! You can try this version later, whose performance will be far better.

I think the problem is due to that key_gen model is trained with vocab_size == 30000 while the dict under data/1-billion/dict.pkl is with 50000 words

Thank you for pointing it out. I will check this problem as soon as possible.

After download all models again, the test looks ok now.
Thanks

I am sorry that I cannot reproduce your problem. The model provided in the repo is just for test. Maybe you should consider training a new better language model.

BTW, the GPT-2 version of CGMH is on the way! You can try this version later, whose performance will be far better.

Hi Miao, I was wondering if the GPT-2 version is ready for us to have a try? We are hoping to use it as a strong baseline.