Replace filepath with uri in wav_dataset.py for Compatibility with torchaudio 2.1.1
michelemancusi opened this issue · 1 comments
Hello,
I've encountered an issue with the wav_dataset.py
in the audio-data-pytorch/audio_data_pytorch/datasets
repository when using torchaudio version 2.1.1. The torchaudio.load
function has changed its parameters, affecting lines 60 and 103 of the wav_dataset.py
file.
Issue Description
In torchaudio 2.1.1, the torchaudio.load
function no longer uses the filepath
argument. Instead, it has been replaced with uri
. This change causes errors in the following lines of the wav_dataset.py
script:
-
Line 60:
Original Code:
waveform, sample_rate = torchaudio.load(filepath=self.wavs[idx], frame_offset=frame_offset, num_frames=crop_size)Proposed Change:
waveform, sample_rate = torchaudio.load(uri=self.wavs[idx], frame_offset=frame_offset, num_frames=crop_size) -
Line 103:
Original Code:
waveform, sample_rate = torchaudio.load(filepath=self.wavs[idx])Proposed Change:
waveform, sample_rate = torchaudio.load(uri=self.wavs[idx])
Suggested Fix:
To maintain compatibility with torchaudio version 2.1.1, I suggest updating these lines to use the uri parameter instead of filepath or removing the filepath
keyword and passing the path directly as the first argument . This change should resolve the compatibility issue and ensure the script functions correctly with the latest version of torchaudio.
Thank you for your attention to this matter. I look forward to the update or any alternative solutions you might suggest.
Best regards,
Michele Mancusi
Good PR, I have the same problem