Skip to content

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

@michelemancusi

Description

@michelemancusi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions