Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy and type errors #4

Open
keto33 opened this issue May 28, 2020 · 8 comments
Open

numpy and type errors #4

keto33 opened this issue May 28, 2020 · 8 comments

Comments

@keto33
Copy link

keto33 commented May 28, 2020

I believe the code should be updated due to some changes in numpy and handling the types. In running the first example, I got this set of errors:

loading example backing track CQT
exception in save_outputs hasattr(): attribute name must be string: Traceback (most recent call last):
  File "/home/keto/autotuner/utils.py", line 364, in save_outputs
    bplt.save(bplt.gridplot([s1], [s2], [s3], [s4]))
  File "/home/keto/.local/lib/python3.8/site-packages/bokeh/layouts.py", line 261, in gridplot
    if not hasattr(Location, toolbar_location):
TypeError: hasattr(): attribute name must be string
 skipping song survive_4_vocals
using silent backing track
Traceback (most recent call last):
  File "/home/keto/.local/lib/python3.8/site-packages/numpy/core/function_base.py", line 117, in linspace
    num = operator.index(num)
TypeError: 'numpy.float64' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rnn.py", line 804, in <module>
    program.autotune_iters(dataloader=program.realworld_dataset)
  File "rnn.py", line 628, in autotune_iters
    utils.synthesize_result(self.realworld_audio_output_directory, data_dict['perf_id'], data_dict['arr_id'],
  File "/home/keto/autotuner/utils.py", line 447, in synthesize_result
    temp_shifted = psola_shift_pitch(
  File "/home/keto/autotuner/psola.py", line 40, in psola_shift_pitch
    new_signal_list.append(psola(signal, peaks, f_ratio))
  File "/home/keto/autotuner/psola.py", line 109, in psola
    new_peaks_ref = np.linspace(0, len(peaks) - 1, len(peaks) * f_ratio)
  File "<__array_function__ internals>", line 5, in linspace
  File "/home/keto/.local/lib/python3.8/site-packages/numpy/core/function_base.py", line 119, in linspace
    raise TypeError(
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.

@niallmandal
Copy link

I just rounded that section to an integer and it seemed to work.

@niallmandal
Copy link

int(len(peaks) * f_ratio)

@keto33
Copy link
Author

keto33 commented Jun 8, 2020

I confirm I could resolve the issue by modifying psola.py as you suggested. However, I encountered another error:

training list length 0 validation list 0
loading example backing track CQT
exception in save_outputs hasattr(): attribute name must be string: Traceback (most recent call last):
  File "/home/keto/autotuner/utils.py", line 364, in save_outputs
    bplt.save(bplt.gridplot([s1], [s2], [s3], [s4]))
  File "/home/keto/.local/lib/python3.8/site-packages/bokeh/layouts.py", line 261, in gridplot
    if not hasattr(Location, toolbar_location):
TypeError: hasattr(): attribute name must be string
 skipping song survive_4_vocals
using silent backing track

Of course, I could make the code work and get the output by skipping plotting.

@niallmandal
Copy link

I skipped that part to be honest. I assume it’s only the instrumental version of the song that it mixed with the vocals and returned. I edited the code to only return the raw edited vocals.

I don’t think it would be too hard to load the backing track separately and then just put the two on top of eachother.

@ruslanakhmetov1986
Copy link

I skipped that part to be honest. I assume it’s only the instrumental version of the song that it mixed with the vocals and returned. I edited the code to only return the raw edited vocals.

I don’t think it would be too hard to load the backing track separately and then just put the two on top of eachother.

Were you able to run your audio files? I could not prepare audio

1 similar comment
@ruslanakhmetov1986
Copy link

I skipped that part to be honest. I assume it’s only the instrumental version of the song that it mixed with the vocals and returned. I edited the code to only return the raw edited vocals.

I don’t think it would be too hard to load the backing track separately and then just put the two on top of eachother.

Were you able to run your audio files? I could not prepare audio

@dmckinno
Copy link

dmckinno commented Dec 13, 2020

The type error from utils.py is fixed by replacing:

  •    bplt.save(bplt.gridplot([s1], [s2], [s3], [s4]))
    

with:

  •    bplt.save(bplt.gridplot([[s1], [s2], [s3], [s4]]))
    

This error is caused by a 2.0+ version of bokeh.

@Jerchongkong
Copy link

This is a problem between versions of Numpy, until they update the code (I doubt they will) you should use an older version of numpy:

booksa == 0.6
numba == 0.48
numpy == 1.17.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants