Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions nemo/collections/audio/models/maxine/bnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,19 @@ def forward(self, input_signal):
)
)

if input_signal.shape[-1] % SUPPORTED_INPUT_ALIGN_SAMPLES != 0:
raise ValueError("Input samples must be a multiple of {}".format(SUPPORTED_INPUT_ALIGN_SAMPLES))

return self.seasr.forward(x0=input_signal)
# Pad input to nearest multiple of SUPPORTED_INPUT_ALIGN_SAMPLES
original_length = input_signal.shape[-1]
remainder = original_length % SUPPORTED_INPUT_ALIGN_SAMPLES
if remainder != 0:
pad_length = SUPPORTED_INPUT_ALIGN_SAMPLES - remainder
input_signal = F.pad(input_signal, (0, pad_length))
output = self.seasr.forward(x0=input_signal)

# Trim output back to original length
if remainder != 0:
output = output[..., :original_length]

return output

def training_step(self, batch, batch_idx):
if isinstance(batch, dict):
Expand Down
Loading