Rayhane-mamah / Tacotron-2

DeepMind's Tacotron-2 Tensorflow implementation
MIT License
2.27k stars 905 forks source link

AttributeError module 'tensorflow' has no attribute 'contrib' #462

Open yilmazay74 opened 4 years ago

yilmazay74 commented 4 years ago

While I want to follow the basic tutorial steps on the main page of Tacotron-2, and when I want to run preprocess.ph, it throws this error: root@1244bf83b4ef:/Tacotron-2# python preprocess.py 2020-03-09 09:57:49.580201: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer.so.6 2020-03-09 09:57:49.581490: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer_plugin.so.6 Traceback (most recent call last): File "preprocess.py", line 6, in from hparams import hparams File "/Tacotron-2/hparams.py", line 5, in hparams = tf.contrib.training.HParams( AttributeError: module 'tensorflow' has no attribute 'contrib' root@1244bf83b4ef:/Tacotron-2#

Can anyyone tell me how to overcome this problem? I googled a little bit, they say it is because of the incompabtibility between TF1x and TF2. And They say there is no easy way to convert the py scripts into TF2. Can you please show me a workaround ? Best Regards

peteseta commented 4 years ago

A workaround is to downgrade to TensorFlow 1.15. use pip or conda to downgrade.

e.g. conda install tensorflow==1.15 which removed my installation of 2.x and installed 1.15 instead.

it's best if you do this in a virtual env or conda env so your other 2.x projects will work the same.

kevastator commented 4 years ago

Yes installing the latest version of TensorFlow 1 would work. Uninstall TensorFlow 2 if any issues come up