music-demixing-challenge-starter-kit icon indicating copy to clipboard operation
music-demixing-challenge-starter-kit copied to clipboard

The format of the wav file is unknown.

Open tkeshun opened this issue 3 years ago • 5 comments

I get a RuntimeError when I run the fourth Try out random prediction codebase present in test.py. in Setup. I found that the format of the wav file in data/test was unknown. I opened this wav file in audacity, but it showed up as a file of unknown format. Is this wav file the correct one? Sorry if this is my mistake. The full text of the error is below.

> python3 test.py
Mixture file is present at following location: /home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav
Traceback (most recent call last):
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 142, in run
    self.evaluation()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 129, in evaluation
    self.prediction(mixture_file_path=self.get_music_file_location(music_name),
  File "test.py", line 52, in prediction
    x, rate = sf.read(mixture_file_path)  # mixture is stereo with sample rate of 44.1kHz
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 256, in read
    with SoundFile(file, 'r', samplerate, channels,
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1183, in _open
    _error_check(_snd.sf_error(file_ptr),
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1357, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav': File contains data in an unknown format.

Traceback (most recent call last):
  File "test.py", line 64, in <module>
    submission.run()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 148, in run
    raise e
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 142, in run
    self.evaluation()
  File "/home/shun/aicrowd/music-demixing-challenge-starter-kit/evaluator/music_demixing.py", line 129, in evaluation
    self.prediction(mixture_file_path=self.get_music_file_location(music_name),
  File "test.py", line 52, in prediction
    x, rate = sf.read(mixture_file_path)  # mixture is stereo with sample rate of 44.1kHz
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 256, in read
    with SoundFile(file, 'r', samplerate, channels,
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1183, in _open
    _error_check(_snd.sf_error(file_ptr),
  File "/home/shun/.local/share/virtualenvs/music-demixing-challenge-starter-kit-dMCFg2FA/lib/python3.8/site-packages/soundfile.py", line 1357, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav': File contains data in an unknown format.

tkeshun avatar May 05 '21 16:05 tkeshun

i guess this is a git-lfs error (do you really have valid files on your disk - did you check the filesize?)

Python 3.9.1 (default, Dec 10 2020, 10:36:41)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import soundfile as sf
>>> sf.read("data/test/Mu - Too Bright/mixture.wav")
(array([[-0.09933472, -0.09863281],
       [-0.11071777, -0.08987427],
       [-0.12136841, -0.08178711],
       ...,
       [-0.04922485, -0.08898926],
       [-0.04959106, -0.08755493],
       [-0.04937744, -0.08685303]]), 44100)

faroit avatar May 05 '21 16:05 faroit

@tkeshun, adding to above comment.

In your repository please try out the following:

git lfs pull

In case this command fails, you need to install git-lfs in your system or upgrade your git version.

Please let us know in case you continue facing the issue.

skbly7 avatar May 05 '21 17:05 skbly7

@skbly7 I got the git-lfs error as you suggested. Here is what I did. I checked the file size.

> ls -l * | awk '{print $5}'
132
132
132
132
132

The file size was 132 bytes, which is very small. I installed git lfs and ran git lfs pull on data/test/Mu - Too Bright.

> ls -l * | awk '{print $5}'
1234844
1234844
1234844
1234844
1234844

> python3 test.py May 06, 2021 02:45:35 PM
Mixture file is present at the following location: /home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav
/home/shun/aicrowd/music-demixing-challenge-starter-kit/data/test/Mu - Too Bright/mixture.wav: prediction completed.
Successfully generated predictions!

The file was successfully executed. Thank you for your help!

tkeshun avatar May 05 '21 17:05 tkeshun

Glad to hear it!

Closing this issue and waiting to see you on the leaderboard soon. 🚀

skbly7 avatar May 05 '21 17:05 skbly7

@skbly7 should we add more docs on git lfs installation requirement?

faroit avatar May 08 '21 07:05 faroit