numpy and type errors
keto33 opened this issue · comments
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.
I just rounded that section to an integer and it seemed to work.
int(len(peaks) * f_ratio)
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.
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.
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
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
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.
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.