martin-gorner / tensorflow-rnn-shakespeare

Code from the "Tensorflow and deep learning - without a PhD, Part 2" session on Recurrent Neural Networks.
Apache License 2.0
533 stars 249 forks source link

Slight incompatibilites with TF 1.0 #3

Closed suissemaxx closed 7 years ago

suissemaxx commented 7 years ago

I ran into some version errors with Tensorflow 1.0

AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'rnn_cell'

(already mentioned by rogerallen)

ValueError: Only call softmax_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...)

I had to change lines 75-78 of rnn_train.py to

onecell = tf.contrib.rnn.GRUCell(INTERNALSIZE) dropcell = tf.contrib.rnn.DropoutWrapper(onecell, input_keep_prob=pkeep) multicell = tf.contrib.rnn.MultiRNNCell([dropcell]*NLAYERS, state_is_tuple=False) multicell = tf.contrib.rnn.DropoutWrapper(multicell, output_keep_prob=pkeep)

and line 100 to

loss = tf.nn.softmax_cross_entropy_with_logits(logits = Ylogits, labels = Yflat_)

And btw: Thank you very much for your excellent presentation! Extremely helpful. And fun to watch...

martin-gorner commented 7 years ago

fixed Thank you for your kind comments.