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

Cannot train: 'tuple' object has no attribute 'eval' #47

Closed wichtounet closed 7 years ago

wichtounet commented 8 years ago

Hi,

I tried this implementation of char-rnn and I have an issue with the train script:

Traceback (most recent call last): File "train.py", line 111, in main() File "train.py", line 48, in main train(args) File "train.py", line 93, in train state = model.initial_state.eval() AttributeError: 'tuple' object has no attribute 'eval'

I'm using the last version of tensorflow and Python 3.4.

Thanks

johnxqiu commented 7 years ago

in train.py try replacing the line state = model.initial_state.eval() with model.initial_state = tf.convert_to_tensor(model.initial_state) state = model.initial_state.eval()

It worked for me but I'm not sure how it would affect performance. Interestingly, I only experienced this problem when I compiled TF for use of my gpu.

astr010 commented 7 years ago

I am using Ubuntu/Linux 64-bit CPU Only, Python 2.7 Tensorflow-0.11 and this fixed my issue

wichtounet commented 7 years ago

I fixed this issue using sess.run which seems to make more sense in my opinion.