Tacotron-2: ValueError: operands could not be broadcast together with shapes (1,1025) (0,)

Created on 30 Jan 2019  路  11Comments  路  Source: Rayhane-mamah/Tacotron-2

Hello,

I'm getting error as in the title just after starting train.py script. I sucessfully ran preprocessing on Polish (pl_PL) M-AILABS dataset. I'm using Python 3.6, CUDA 10.0 and Windows 10. Logs:

initialisation done /gpu:0
Initialized Tacotron model. Dimensions (? = dynamic shape):
  Train mode:               False
  Eval mode:                True
  GTA mode:                 False
  Synthesis mode:           False
  Input:                    (?, ?)
  device:                   0
  embedding:                (?, ?, 512)
  enc conv out:             (?, ?, 512)
  encoder out:              (?, ?, 512)
  decoder out:              (?, ?, 80)
  residual out:             (?, ?, 512)
  projected residual out:   (?, ?, 80)
  mel out:                  (?, ?, 80)
  linear out:               (?, ?, 1025)
  <stop_token> out:         (?, ?)
  Tacotron Parameters       29.016 Million.
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 "E:\tts\tacotron\train.py", line 399, in tacotron_train
    return train(log_dir, args, hparams)
  File "E:\tts\tacotron\train.py", line 176, in train
    GLGPU_mel_outputs = audio.inv_mel_spectrogram_tensorflow(GLGPU_mel_inputs, hparams)
  File "E:\tts\datasets\audio.py", line 142, in inv_mel_spectrogram_tensorflow
    S = _mel_to_linear_tensorflow(S, hparams)  # Convert back to linear
  File "E:\tts\datasets\audio.py", line 240, in _mel_to_linear_tensorflow
    _inv_mel_basis = np.linalg.pinv(_build_mel_basis(hparams))
  File "E:\tts\datasets\audio.py", line 246, in _build_mel_basis
    fmin=hparams.fmin, fmax=hparams.fmax)
  File "C:\Users\konra\AppData\Roaming\Python\Python36\site-packages\librosa\filters.py", line 247, in mel
    lower = -ramps[i] / fdiff[i]
ValueError: operands could not be broadcast together with shapes (1,1025) (0,)

Does anyone know why this problem occurs?

Most helpful comment

Hello, please update to librosa v0.6.2

All 11 comments

I am also encountering this error.

Edit: After doing pip install -r requirements again the problem was fixed.

I am also encountering this error.

Edit: After doing pip install -r requirements again the problem was fixed.

I will check this solution. Meanwhile, can you tell me which Python, CUDA and OS version are you using?

Hello, please update to librosa v0.6.2

Hello,

The solution that worked for me to solve this problem was to have these versions for:

  • Python: 3.6
  • CUDA: 9.0
  • CuDNN 7.0.5
  • TensorFlow / TensorFlow-GPU : 1.0.9
  • Install packages mentioned in requirements.txt using the command: pip install -r path/to/requirements.txt

The problem seems to be that the Tensorflow 1.13 installation may install a newer version of numpy then what is in the requirements.txt file, and Tacotron-2 does not seem to work correctly with newest numpy (unsure if this is related to older librosa, it may work with newer numpy + newer librosa, ref below).

So, a few reasons why the above solutions work in one way or another; re-running the requirements.txt would remove the numpy installed by Tensorflow installation, and reset the numpy to the version specified in the requirements.txt file. Also, using an older TensorFlow may do something similar (i.e. use an older version of Numpy).

I suspect that the librosa change to 0.6.2 (assuming a manual update is used - as the version is hardcoded in requirements.txt) is another way to get it to work as in that case you can keep the new numpy (ref referenced bug), assuming that works, or if you re-ran requirements wit the librosa updated there, it may start working as numpy will also be reset to older version now.

Bit more debugging needed by dev before fixing, but I suspect that the easiest way to get this bug closed is by upping the requirement for both numpy and librosa in the requirements.txt to the current versions (if that even works, I just reverted to the required ones) and testing if that works.

I had the same problem. In my case it was because librosa version specified in requirements.txt (0.5.1 ) was not compatible with numpy 1.16.3 (which I had already installed) So I upgraded librosa to 0.6.3 and it solved the problem.

Hi, I migrated to Azure ML machine and everything works correctly there, @sajadshah and @venxca123 provided good solution I think so I'm closing this. Thank you for your help!

Hello, please update to librosa v0.6.2

This is what worked for me

Yep. I had same issue.

sudo pip install librosa==0.7.2, solves the problem

i also had the same problem.
my librosa was 0.5.1 and i upgraded it to 0.6.2
pip3 install librosa==0.6.2, solved it for me.

for me, the problem was solved by using numpy==1.15.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrgloom picture mrgloom  路  4Comments

imdatsolak picture imdatsolak  路  5Comments

Yeongtae picture Yeongtae  路  3Comments

sunnnnnnnny picture sunnnnnnnny  路  3Comments

mindmapper15 picture mindmapper15  路  10Comments