training-charRNN icon indicating copy to clipboard operation
training-charRNN copied to clipboard

TensorFlow 2.0 compatibility?

Open shiffman opened this issue 5 years ago • 3 comments

I believe this training script only works with tensorflow 1.x so just noting that we should test / upgrade for compatibility with tensorflow 2.0 at some point.

shiffman avatar Oct 20 '19 22:10 shiffman

Tested this in the up-to-date Colab environment with tensorflow 2.5.0, which gave the error message

ModuleNotFoundError: No module named 'tensorflow.contrib'

for the line

from tensorflow.contrib import rnn

wincentbalin avatar Jul 10 '21 21:07 wincentbalin

These examples show, how to implement LSTM-based char-RNN with recent tensorflow versions:

  • https://github.com/keras-team/keras-io/blob/master/guides/working_with_rnns.py
  • https://keras.io/examples/generative/lstm_character_level_text_generation/
  • Colab Notebook from the previous link

wincentbalin avatar Jul 10 '21 21:07 wincentbalin

One possible workaround would be using Docker image with Tensorflow 1.15.4 and Python 2:

docker run -it -v /home/user1/project1:/project1 -u user1 tensorflow/tensorflow:1.15.4

Change /home/user1/project1 to the directory with files you would like to access in container. The directory in the container, /project1, might be changed too.

The user user1 must be changed to your own user name. The user option -u user1 might be left out completely, but then the files created in the container will belong to the user root.

wincentbalin avatar Jan 31 '23 17:01 wincentbalin