microsoft / MS-SNSD

The Microsoft Scalable Noisy Speech Dataset (MS-SNSD) is a noisy speech dataset that can scale to arbitrary sizes depending on the number of speakers, noise types, and Speech to Noise Ratio (SNR) levels desired.
MIT License
468 stars 142 forks source link

noisyspeech_synthesizer.py fails to run with numpy 1.18.5 #16

Open shivasv97 opened 4 years ago

shivasv97 commented 4 years ago

There seems to be a breaking issue while running the noisyspeech_synthesizer.py while running it on Google Colab. Colab has numpy 1.18.5 at the time this issue was posted. This version is installed by default when connecting to a runtime. On following the standard procedure and prerequisites for running this scipt, it gives the following error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py", line 117, in linspace
    num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./MS-SNSD/noisyspeech_synthesizer.py", line 124, in <module>
    main(cfg._sections[args.cfg_str])
  File "./MS-SNSD/noisyspeech_synthesizer.py", line 47, in main
    SNR = np.linspace(snr_lower, snr_upper, total_snrlevels)
  File "<__array_function__ internals>", line 6, in linspace
  File "/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py", line 121, in linspace
    .format(type(num)))
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.

However, when the numpy version is downgraded from 1.18.5 to 1.16.4, the script works perfectly fine as it is supposed to.

majianjia commented 3 years ago

same here

NisargBhatt73 commented 3 years ago

The same was the case for me, in line number 47 just typecast every argument to int, that worked for me like this -

SNR = np.linspace(int(snr_lower), int(snr_upper), int(total_snrlevels))

jagger2048 commented 3 years ago

This PR may work for this issue #11

anand0427 commented 3 years ago

This bug isn't fixed yet. So anyone working with this follow @NisargBhatt73 suggestion.

anderzzz commented 2 years ago

Still here. But easy fix. Just make lines 13-15 of noisyspeech_synthesizer.py into int. They are only used in for the linspace function

So:

    snr_lower = int(cfg["snr_lower"])
    snr_upper = int(cfg["snr_upper"])
    total_snrlevels = int(cfg["total_snrlevels"])
majianjia commented 2 years ago

There is already a PR for this bug but it seems like this repo is not maintained. https://github.com/microsoft/MS-SNSD/pull/15

truc0 commented 1 year ago

Same problem