From 8969d59902e005c3b04ea983b994e25ef53d45b9 Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Sun, 13 Jan 2019 19:10:03 +0100 Subject: [PATCH] Use the last attention value as a threshold to stop decoding. since stoptoken prediction is not precies enough to synthsis at the right time. --- layers/tacotron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layers/tacotron.py b/layers/tacotron.py index f95b1bc1..1dfa5a3c 100644 --- a/layers/tacotron.py +++ b/layers/tacotron.py @@ -434,7 +434,7 @@ class Decoder(nn.Module): if t >= T_decoder: break else: - if t > inputs.shape[1] / 4 and stop_token > 0.6: + if t > inputs.shape[1] / 4 and (stop_token > 0.6 or attention[:, -1].item() > 0.6): break elif t > self.max_decoder_steps: print(" | > Decoder stopped with 'max_decoder_steps")