iwangjian / textsum-gan

Tensorflow re-implementation of GAN for text summarization
134 stars 56 forks source link

Decoding problem: ValueError #7

Open ghost opened 5 years ago

ghost commented 5 years ago

I trained the model exactly as the steps of README, only for 145 train steps. And I interrupt the training process to have a decoding try. I also typed the command exactly the same as the decode part from README. However, it shows the ValueError.

Loading checkpoint ./log/train/model.ckpt-145 INFO:tensorflow:Restoring parameters from ./log/train/model.ckpt-145 INFO:tensorflow:Wrote example 0 to file INFO:tensorflow:Wrote example 1 to file INFO:tensorflow:Wrote example 2 to file INFO:tensorflow:Wrote example 3 to file INFO:tensorflow:Wrote example 4 to file Traceback (most recent call last): File "main.py", line 202, in tf.app.run() File "/home/amax/anaconda3/envs/tf14/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 196, in main decoder.decode() File "/home/amax/zhj/textsum-gan/decode.py", line 108, in decode best_hyp = beam_search.run_beam_search(self._sess, self._model, self._vocab, batch) File "/home/amax/zhj/textsum-gan/beam_search.py", line 132, in run_beam_search prev_coverage=prev_coverage) File "/home/amax/zhj/textsum-gan/generator.py", line 580, in decode_onestep results = sess.run(to_return, feed_dict=feed) # run the decoder step File "/home/amax/anaconda3/envs/tf14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 889, in run run_metadata_ptr) File "/home/amax/anaconda3/envs/tf14/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1096, in _run % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (3, 256) for Tensor 'seq2seq/reduce_final_st/Relu:0', which has shape '(4, 256)'

The error message made me confused. Could you please help me with this problem please?

iwangjian commented 5 years ago

Does this error occur in your pretraining phase or full training phase?

ghost commented 5 years ago

I used the file discriminator_train_data.npz that you provided in Dropbox directly and there was NO such error in the full training process. I don not know what was going wrong. Thanks a lot for your help!

w5688414 commented 5 years ago

I got the same error when I run decode: ` thon/client/session.py", line 1096, in _run % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (3, 256) for Tensor 'seq2seq/reduce_final_st/Relu:0', which has shape '(4, 256)'

`

iwangjian commented 5 years ago

You could use discriminator_train_data.npz provided in Dropbox to train the model, I will carefully check the code and fix bugs later.