yunjey / show-attend-and-tell

TensorFlow Implementation of "Show, Attend and Tell"
MIT License
907 stars 323 forks source link

error in train.py #29

Open thepurpleowl opened 7 years ago

thepurpleowl commented 7 years ago

WARNING:tensorflow:<tensorflow.python.ops.rnn_cell.BasicLSTMCell object at 0x7fbc2a5b0850>: Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True. Traceback (most recent call last): File "train.py", line 25, in main() File "train.py", line 22, in main solver.train() File "/media/s/F606389C06386033/show-attend-and-tell-tensorflow/core/solver.py", line 77, in train loss = self.model.build_model() File "/media/s/F606389C06386033/show-attend-and-tell-tensorflow/core/model.py", line 168, in buildmodel **, (c, h) = lstm_cell(inputs=tf.concat(1, [x[:,t,:], context]), state=[c, h])* File "/home/s/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell.py", line 305, in call concat = _linear([inputs, h], 4 self._num_units, True) File "/home/s/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/rnn_cell.py", line 886, in _linear raise ValueError("Linear is expecting 2D arguments: %s" % str(shapes)) ValueError: Linear is expecting 2D arguments: [[None, 1024], [2, None, 1024]]

lijianqing317 commented 7 years ago

What is your tensorflow's version?

thepurpleowl commented 7 years ago

tensorflow (0.10.0rc0)

Sorry I was preoccupied, couldn't answer.

jiecaoyu commented 7 years ago

Try to replace that line with

_, (c, h) = lstm_cell(inputs=tf.concat([x[:,t,:], context], 1), state=[c, h])

Tensorflow updates the syntax.

You need to the same thing for line 209. Hope this helps.

lijianqing317 commented 7 years ago

Here I upload I changed part of the code and run it with 1.0,hope it is useful for you

rubenvereecken commented 7 years ago

Hi @lijianqing317, I was interested in your port. I tried running it with TF 1.0 but I noticed you don't include a ported core folder. For example, tf.nn.rnn_cell.BasicLSTMCell was moved to tf.contrib.rnn in TF 1.0 and 1.1 (it's back in 1.2) but core/model.py still uses it.

I'll try my hand at porting, but I don't know how extensive the changes are.

EDIT: My bad, I apparently glossed over model.py. I'll give it a try.

lijianqing317 commented 7 years ago

@rubenvereecken hi,here is I changed code,I only uploaded some of the code to be modified, and did not upload the entire project directory structure.I have changed some code in model.py, for example : lstm_cell = tf.contrib.rnn.BasicLSTMCell(num_units=self.H),and so all 。you can try it