From 7bda48c81e68676cf86e742367f9bc0ff8716287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Tue, 16 Mar 2021 17:23:35 +0100 Subject: [PATCH] fix #382 --- TTS/tts/models/speedy_speech.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TTS/tts/models/speedy_speech.py b/TTS/tts/models/speedy_speech.py index 886d6fd4..101d77a0 100644 --- a/TTS/tts/models/speedy_speech.py +++ b/TTS/tts/models/speedy_speech.py @@ -181,8 +181,12 @@ class SpeedySpeech(nn.Module): x_lengths: [B] g: [B, C] """ + # input sequence should be greated than the max convolution size + inference_padding = 5 + if x.shape[1] < 13: + inference_padding += 13 - x.shape[1] # pad input to prevent dropping the last word - x = torch.nn.functional.pad(x, pad=(0, 5), mode='constant', value=0) + x = torch.nn.functional.pad(x, pad=(0, inference_padding), mode='constant', value=0) o_en, o_en_dp, x_mask, g = self._forward_encoder(x, x_lengths, g) # duration predictor pass o_dr_log = self.duration_predictor(o_en_dp.detach(), x_mask)