predict stop tokens

This commit is contained in:
Eren Golge 2018-04-30 05:29:42 -07:00
parent a3b1db98e9
commit 48086fe568
1 changed files with 4 additions and 2 deletions

View File

@ -14,10 +14,11 @@ class Tacotron(nn.Module):
self.linear_dim = linear_dim
self.embedding = nn.Embedding(len(symbols), embedding_dim,
padding_idx=padding_idx)
print(" | > Number of characted : {}".format(len(symbols)))
print(" | > Number of characters : {}".format(len(symbols)))
self.embedding.weight.data.normal_(0, 0.3)
self.encoder = Encoder(embedding_dim)
self.decoder = Decoder(256, mel_dim, r)
self.stopnet = nn.Sequential(nn.Linear(80, 1), nn.Sigmoid())
self.postnet = CBHG(mel_dim, K=8, projections=[256, mel_dim])
self.last_linear = nn.Linear(mel_dim * 2, linear_dim)
@ -32,6 +33,7 @@ class Tacotron(nn.Module):
# Reshape
# batch x time x dim
mel_outputs = mel_outputs.view(B, -1, self.mel_dim)
stop_tokens = self.stopnet(mel_outputs)
linear_outputs = self.postnet(mel_outputs)
linear_outputs = self.last_linear(linear_outputs)
return mel_outputs, linear_outputs, alignments
return mel_outputs, linear_outputs, alignments, stop_tokens