merlresearch / cocktail-fork-separation

Baseline multi-resolution cross network model trained using the Divide and Remaster Dataset
MIT License
77 stars 12 forks source link

Issue with dependencies of separate.py? #2

Open jmp468 opened 1 year ago

jmp468 commented 1 year ago

setting up the Cocktail Fork Separation pogram, when using Anaconda (pip install and conda install) on windows to import the dependencies--I've noticed when trying to use the Readme command for the pretrained AI; (with a file soundtrack.wav in an input folder) the following response occurs:

(mytestenviornment) C:\Users\Jesse\cocktail-fork-separation-1.1.0>python separate.py --audio-path /input/soundtrack.wav --out-dir /separated/track1 Traceback (most recent call last): File "C:\Users\Jesse\cocktail-fork-separation-1.1.0\separate.py", line 165, in cli_main() File "C:\Users\Jesse\cocktail-fork-separation-1.1.0\separate.py", line 161, in cli_main separate_soundtrack_file(args.audio_path, output_dir, device=device, consistency_mode=args.mixture_residual) File "C:\Users\Jesse\cocktail-fork-separation-1.1.0\separate.py", line 121, in separate_soundtrack_file audio_tensor, fs = torchaudio.load(audio_filepath) File "C:\Users\Jesse\AppData\Roaming\Python\Python39\site-packages\torchaudio\backend\soundfilebackend.py", line 205, in load with soundfile.SoundFile(filepath, "r") as file: File "C:\Users\Jesse.conda\envs\mytestenviornment\lib\site-packages\soundfile.py", line 740, in init self._file = self._open(file, mode_int, closefd) File "C:\Users\Jesse.conda\envs\mytestenviornment\lib\site-packages\soundfile.py", line 1263, in _open raise TypeError("Invalid file: {0!r}".format(self.name)) TypeError: Invalid file: WindowsPath('/input/soundtrack.wav')

How could I fix this? Is this an issue with my installation of the dependencies or something else?

Thanks-

gwichern commented 1 year ago

Hi @jmp468 I believe this is an issue with torchaudio, as they do not have soundfile as a required dependency on windows even though it is needed. Installing soundfile via pip or condo should fix things for you.

We mention this in the README, but it's easy to miss: If you prefer to use the [torchaudio soundfile backend](https://pytorch.org/audio/stable/backend.html) (required on windows) please refer to the [SoundFile documentation](https://pysoundfile.readthedocs.io/en/latest/) for installation instructions.