Stanford-TML / EDGE

Official PyTorch Implementation of EDGE (CVPR 2023)
https://edge-dance.github.io
MIT License
435 stars 63 forks source link

Loading custom music (ValueError: empty range for randrange()) #2

Closed euneestella closed 1 year ago

euneestella commented 1 year ago

Hello, thanks for your amazing work!

I tried to use my custom music(.wav) to test the model following the README with the command python test.py --music_dir custom_music/. However, It raises ValueError. Can you get me how to manage this issue?

Thanks!

Computing features for input music
Slicing custom_music/gasoline.wav
Traceback (most recent call last):
  File "test.py", line 128, in <module>
    test(opt)
  File "test.py", line 81, in test
    rand_idx = random.randint(0, len(file_list) - sample_size)
  File "/opt/conda/envs/edge/lib/python3.8/random.py", line 248, in randint
    return self.randrange(a, b+1)
  File "/opt/conda/envs/edge/lib/python3.8/random.py", line 226, in randrange
    raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0, -1, -1)
jtseng20 commented 1 year ago

The test.py logic manages song lengths by taking random 30 second slices from each song. However, if your song is less than 30 seconds long, then the random choice will fail because there isn't enough music to pick from. That's what the error looks like to me, at a glance. Hope that helps.

euneestella commented 1 year ago

Now it works! Thanks for the comment

h0han commented 2 months ago

Hello, in that case, is there any way to generate the motion for audio files that are shorter than 30 seconds?