pytorch / pytorch/audio

Moving WaveRNN padding into the model

Open
#1,869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
799
Avg merge
58m
Merged PRs (30d)
3

Description

Currently WaveRNN's forward method expects client code to to pad the input spectrogram to the specific size (kernel_size - 1 // 2). This breaks the encapsulation. The WaveRNN's forward method should perform padding itself. The newly added infer method does this.

General direction

  1. In forward, add padding before upsample.
    https://github.com/pytorch/audio/blob/483d8fae63f0102a31e9842a593f462399116fbd/torchaudio/models/wavernn.py#L319-L322
    as done in infer
    https://github.com/pytorch/audio/blob/483d8fae63f0102a31e9842a593f462399116fbd/torchaudio/models/wavernn.py#L381
  2. Update the collate function in the training script so that it does not perform padding
    https://github.com/pytorch/audio/blob/a6f9cf8babfb096381e914e23950371478672b3e/examples/pipeline_wavernn/datasets.py#L76
  3. Update tests and surrounding comments about the shape.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in torchaudio/models/wavernn.py at the forward and infer methods, then inspect examples/pipeline_wavernn/datasets.py and the existing shape-related tests and comments. Move the padding responsibility into forward, remove it from the training collate function, and update tests and comments so the expected shapes and behavior are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
audio-video-rtc, machine-learning
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.