sherjilozair / char-rnn-tensorflow

Multi-layer Recurrent Neural Networks (LSTM, RNN) for character-level language models in Python using Tensorflow
MIT License
2.64k stars 960 forks source link

Can not convert a list into a Tensor or Operation #16

Closed mohit-flipkart closed 7 years ago

mohit-flipkart commented 8 years ago

Using python 2.7 & the following libraries & the latest 'master' branch. This leads to the error below (which doesn't happen when I roll back to the earlier branch:ae-rnn)

(venv)root@# python train.py I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcublas.so.7.0 locally I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcudnn.so.6.5 locally I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcufft.so.7.0 locally I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcuda.so locally I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcurand.so.7.0 locally

....

File "train.py", line 64, in train trainloss, state, = sess.run([model.cost, model.final_state, model.train_op], feed) File "/usr/share/venv/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 330, in run % (subfetch, fetch, type(subfetch), str(e))) TypeError: Fetch argument [<tf.Tensor 'zeros:0' shape=(?, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_1:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_2:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_3:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_4:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_5:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_6:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_7:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_8:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_9:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_10:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_11:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_12:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_13:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_14:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_15:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_16:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_17:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_18:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_19:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_20:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_21:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_22:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_23:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_24:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_25:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_26:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_27:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_28:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_29:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_30:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_31:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_32:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_33:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_34:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_35:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_36:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_37:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_38:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_39:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_40:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_41:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_42:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_43:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_44:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_45:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_46:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_47:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_48:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_49:0' shape=(50, 512) dtype=float32>] of [<tf.Tensor 'zeros:0' shape=(?, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_1:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_2:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_3:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_4:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_5:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_6:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_7:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_8:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_9:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_10:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_11:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_12:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_13:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_14:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_15:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_16:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_17:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_18:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_19:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_20:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_21:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_22:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_23:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_24:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_25:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_26:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_27:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_28:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_29:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_30:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_31:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_32:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_33:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_34:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_35:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_36:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_37:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_38:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_39:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_40:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_41:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_42:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_43:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_44:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_45:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_46:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_47:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_48:0' shape=(50, 512) dtype=float32>, <tf.Tensor 'rnnlm_1/concat_49:0' shape=(50, 512) dtype=float32>] has invalid type <type 'list'>, must be a string or Tensor. (Can not convert a list into a Tensor or Operation.)

jkerfs commented 8 years ago

Check your version of TensorFlow. The latest version of char-rnn-tensorflow uses TF 7.1, and there were a number of breaking changes in TF 7.0. If you have a previous version of TF, the code will no longer work. Here is the specific API change that is causing problems:

The non-public nn.rnn and the various nn.seq2seq methods now return just the final state instead of the list of all states.

Breaking Changes to the API in version 7.0

hugovk commented 7 years ago

@mohit-flipkart Can this be closed?

carlesventura commented 7 years ago

Same problem here. How did you solve it?

sherjilozair commented 7 years ago

What TF version are you using?

ubergarm commented 7 years ago

This seems to be working w/ TF 1.0. Check the travis-ci builds now if you want more details for specific python versions.

I am locally running Python 2.7x and TF 1.0 and haven't seen this problem.

Feel free to open a new issue and post your exact Python and TF versions and which git hash versin of this repo you're testing.

Thanks all for contributing!