Rayhane-mamah / Tacotron-2

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

AttributeError:"module 'tensorflow.python.ops.rnn_cell_impl' has no attribute 'assert_like_rnncell'" #400

Open moonnee opened 5 years ago

moonnee commented 5 years ago

Hi, thanks for your great work. I tried to run this work with tf1.6 on one GPU with mode 'Tacotron'. But got attribueError as below:

_Traceback (most recent call last):
  File "train.py", line 138, in <module>
    main()
  File "train.py", line 128, in main
    tacotron_train(args, log_dir, hparams)
  File "/exp/Tacotron2_tf/tacotron/train.py", line 399, in tacotron_train
    return train(log_dir, args, hparams)
  File "/exp/Tacotron2_tf/tacotron/train.py", line 156, in train
    model, stats = model_train_mode(args, feeder, hparams, global_step)
  File "/exp/Tacotron2_tf/tacotron/train.py", line 87, in model_train_mode
    is_training=True, split_infos=feeder.split_infos)
  File "/exp/Tacotron2_tf/tacotron/models/tacotron.py", line 170, in initialize
    CustomDecoder(decoder_cell, self.helper, decoder_init_state),
  File "/exp/Tacotron2_tf/tacotron/models/custom_decoder.py", line 43, in __init__
    rnn_cell_impl.assert_like_rnncell(type(cell), cell)
AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute 'assert_like_rnncell'_

Not sure whether it is a matter of tensorflow version. Could anyone give some suggestions? What version of tensorflow works well? Thanks.

416207298 commented 5 years ago

It occurs to me, too. Have you solved it? I hope the lastet version of tensorflow would work.

moonnee commented 5 years ago

It occurs to me, too. Have you solved it? I hope the lastet version of tensorflow would work.

Not yet. Still don't know which version of tensorflow works.

416207298 commented 5 years ago

Try this and see if it works: #253

moonnee commented 5 years ago

Try this and see if it works: #253

Thanks a lot. WIll try!

416207298 commented 5 years ago

Unfortunately, I installed tensorflow-gpu 1.7, and still don't work. Mistakes:

AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute 'assert_like_runcell'
416207298 commented 5 years ago

Hey bro, I just added this function myself through here: tensorflow source code, I added 'assert_like_runcell' at the head of "~/.local/lib/python3.x/site-pakages/tensorflow/python/ops/rnn_cell_impl.py". After that, it can start training.

But here's another problem: After training for two steps like below, it just Aborted. I can't figure out why... I used the default parameters inhparams.py. Maybe I should change it somewhere?

Generated 20 test batches of size 32 in 1.118sec

Generated 64 train batches of size 32 in 3.095sec
Aborted(core dumped)
WenjianDing commented 5 years ago

you can just find this function on tf1.9 and copy this into your tf1.6 in right place, have the same problem and solved it.

mangalbhaskar commented 4 years ago

Quite a old thread, hope it may help someone:

NOTE: Using this repo: https://github.com/r9y9/Tacotron-2.git [and this brach: commit bbc6e3cd860d1ec01e65a97070e32a7adc6d7f17 (HEAD -> wavenet3, origin/wavenet3) ]

Despite different code base sharing the workaround fix here, because it's the same error in the context of tacotron2.

As a fix, I commented out the line as it was only checking for RNN cell. I made an assumption that this is the extra check and ideally should never happen. It kind of worked and I was able to get to the next step.

Environment:

Tensorflow -1.13.1, CUDA-10.0, Nvidia RTX 2060, Ubuntu 18.04 LTS

On executing the following:

python synthesize.py --model='Tacotron' --mode='eval' \
  --hparams='symmetric_mels=False,max_abs_value=4.0,power=1.1,outputs_per_step=1' \
  --text_list=/aimldl-dat/data-public/ljspeech/text_list.txt \
  --input_dir=/aimldl-dat/data-public/ljspeech \
  --checkpoint=/aimldl-dat/release/r9y9/tacotron/pretrained

I also got something similar error, but instead of assert_like_rnncell at line 41, i got error about _like_rnncell at line 47 in tacotron/models/custom_decoder.py". Logs below:

Traceback (most recent call last):
  File "synthesize.py", line 34, in <module>
    main()
  File "synthesize.py", line 28, in main
    tacotron_synthesize(args)
  File "/codehub/external/r9y9-tacotron2/tacotron/synthesize.py", line 81, in tacotron_synthesize
    run_eval(args, checkpoint_path, output_dir, sentences)
  File "/codehub/external/r9y9-tacotron2/tacotron/synthesize.py", line 14, in run_eval
    synth.load(checkpoint_path)
  File "/codehub/external/r9y9-tacotron2/tacotron/synthesizer.py", line 24, in load
    self.model.initialize(inputs, input_lengths)
  File "/codehub/external/r9y9-tacotron2/tacotron/models/tacotron.py", line 112, in initialize
    CustomDecoder(decoder_cell, self.helper, decoder_init_state),
  File "/codehub/external/r9y9-tacotron2/tacotron/models/custom_decoder.py", line 47, in __init__
    if not rnn_cell_impl._like_rnncell(cell):  # pylint: disable=protected-access
AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_like_rnncell'
Tanxj commented 3 years ago

Verified solution in python 3.6: If the tensorflow version is lower than or equal to 1.9, 'rnn_cell_impl._like_rnncell' is available; if the version is higher than or equal to 1.13, you have to change to 'assert_like_rnncell'