Skip to content

Commit

Permalink
Fix the bug of DecoderPrenetWrapper
Browse files Browse the repository at this point in the history
We should put DecoderPrenetWrapper outside AttentionWrapper. Otherwise, the AttentionWrapper concatenates the input and previous attention vector before calling the internal cell, so dropout in the DecoderPrenetWrapper will drop 50% information of previous attention vector.
  • Loading branch information
npuichigo authored Aug 31, 2018
1 parent 779efd9 commit bc20c40
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion models/tacotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ def initialize(self, inputs, input_lengths, mel_targets=None, linear_targets=Non

# Attention
attention_cell = AttentionWrapper(
DecoderPrenetWrapper(GRUCell(hp.attention_depth), is_training, hp.prenet_depths),
GRUCell(hp.attention_depth),
BahdanauAttention(hp.attention_depth, encoder_outputs),
alignment_history=True,
output_attention=False) # [N, T_in, attention_depth=256]

# Apply prenet before concatenation in AttentionWrapper.
attention_cell = DecoderPrenetWrapper(attention_cell, is_training, hp.prenet_depths)

# Concatenate attention context vector and RNN cell output into a 2*attention_depth=512D vector.
concat_cell = ConcatOutputAndAttentionWrapper(attention_cell) # [N, T_in, 2*attention_depth=512]
Expand Down

0 comments on commit bc20c40

Please sign in to comment.