Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace filepath with uri in wav_dataset.py for Compatibility with torchaudio 2.1.1 #9

Open
michelemancusi opened this issue Nov 21, 2023 · 1 comment

Comments

@michelemancusi
Copy link

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:

  1. 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)

  2. 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

@adrienpl
Copy link

Good PR, I have the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants