ml5js / training-charRNN

Training charRNN model for ml5js
Other
96 stars 46 forks source link

TensorFlow 2.0 compatibility? #17

Open shiffman opened 4 years ago

shiffman commented 4 years ago

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.

wincentbalin commented 3 years ago

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 commented 3 years ago

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

wincentbalin commented 1 year ago

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.