audiocraft
audiocraft copied to clipboard
Permission Error when writing track
This is on Windows. It was working fine until the latest git pull this morning. The model runs fun with a prompt, but it won't write the resulting file.
Traceback (most recent call last): File "D:\Developer\audiocraft\audiocraft\data\audio.py", line 209, in audio_write ta.save(path, wav, sample_rate, **kwargs) File "C:\Users\ethan\miniconda3\lib\site-packages\torchaudio\backend\soundfile_backend.py", line 451, in save soundfile.write(file=filepath, data=src, samplerate=sample_rate, subtype=subtype, format=format) File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 430, in write with SoundFile(file, 'w', samplerate, channels, File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 740, in init self._file = self._open(file, mode_int, closefd) File "C:\Users\ethan\miniconda3\lib\site-packages\soundfile.py", line 1263, in _open raise TypeError("Invalid file: {0!r}".format(self.name)) TypeError: Invalid file: WindowsPath('C:/Users/ethan/AppData/Local/Temp/tmpg6flfv08.wav')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\routes.py", line 393, in run_predict output = await app.get_blocks().process_api( File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\blocks.py", line 1108, in process_api result = await self.call_function( File "C:\Users\ethan\miniconda3\lib\site-packages\gradio\blocks.py", line 915, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\ethan\miniconda3\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\ethan\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Users\ethan\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "D:\Developer\audiocraft\app.py", line 138, in predict_full outs = _do_predictions( File "D:\Developer\audiocraft\app.py", line 102, in _do_predictions audio_write( File "D:\Developer\audiocraft\audiocraft\data\audio.py", line 213, in audio_write path.unlink() File "C:\Users\ethan\miniconda3\lib\pathlib.py", line 1206, in unlink self._accessor.unlink(self) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\ethan\AppData\Local\Temp\tmpg6flfv08.wav'
same issue
same issue
I have moved "musicgen_app.py" and "musicgen_demo.ipynb" together to the root folder. It worked for me. If you try to run in dome folder it couses an error. Also if you move "musicgen_app.py" alone it couses the "PermissionError: [WinError 32]" error. I hope it will be helpful.
se ha resuelto el error ejecutando como administrador el anaconda prompt y moviendo "musicgen_app.py" y "musicgen_demo.ipynb" a la carpeta raiz como sugiere Soztrk, aunque esto ultimo no se si sea necesario
I have moved "musicgen_app.py" and "musicgen_demo.ipynb" together to the root folder. It worked for me. If you try to run in dome folder it couses an error. Also if you move "musicgen_app.py" alone it couses the "PermissionError: [WinError 32]" error. I hope it will be helpful.
i have moved both and still get the error :(
You need to install ffmpeg on windows.
winget install ffmpeg
Close all terminals or reboot pc.