rncm-prism / prism-samplernn

Neural sound synthesis with TensorFlow 2
MIT License
115 stars 20 forks source link

List index out of range #19

Open AshleighHazel opened 3 years ago

AshleighHazel commented 3 years ago

Hello, Sorry if this is a naive question very new to python. I'm running the code in a colab note book and I keep getting this error for the train.py script

Traceback (most recent call last): File "train.py", line 335, in main() File "train.py", line 257, in main samples0, _ = librosa.load(train_split[0], sr=None, mono=True) IndexError: list index out of range

I'm using all default parameters.

Thanks Ash

relativeflux commented 3 years ago

@AshleighHazel Hi there, thanks for getting in touch. This looks like a problem with your dataset, either its contents or the location you're passing.

So this is basically the kind of thing that's happening:

>>> train_split = []
>>> train_split[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

So the train_split list is empty, whereas it should be a list of strings, each one denoting the path to an audio chunk in your dataset. Your dataset should be a folder of audio chunks, prepared using the chunk_audio.py script (technically you don't need to use that script, as long as you have a folder of audio chunks of equal length that will be fine). Typically I work with 8 second chunks, at 16kHz sample rate (can be mono or stereo, but everything is converted to mono during training).

Or perhaps the issue is the location of the dataset. Are you sure you're passing the right path, via the --data_dir param to train.py?

AshleighHazel commented 3 years ago

@relativeflux Thanks so much for your response, it seems like my data set was just too small for the parameters I was using, I uploaded a longer audio file and it is working now. Thanks for pointing me in the right direction and for the code, loving the results!