Skip to content

Commit

Permalink
Merge pull request Rayhane-mamah#23 from metaln37/master
Browse files Browse the repository at this point in the history
TacoTrainingHelper bugfix
  • Loading branch information
Rayhane-mamah authored Apr 18, 2018
2 parents d28cfa9 + 8514855 commit 7dab3b4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tacotron/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@ def next_inputs(self, time, outputs, state, sample_ids, stop_token_prediction, n
#GTA synthesis stop
finished = (time + 1 >= self._lengths)

if np.random.random() <= self._ratio:
next_inputs = self._targets[:, time, :] #Teacher-forcing: return true frame
else:
next_inputs = outputs[:, -self._output_dim:]
next_inputs = tf.cond(
tf.equal(tf.mod(time, int(1./self._ratio)), 0),
lambda: self._targets[:, time, :],
lambda: outputs[:,-self._output_dim:])

#Update the finished state
next_state = state.replace(finished=tf.cast(tf.reshape(finished, [-1, 1]), tf.float32))
return (finished, next_inputs, next_state)


def _go_frames(batch_size, output_dim):
'''Returns all-zero <GO> frames for a given batch size and output dimension'''
return tf.tile([[0.0]], [batch_size, output_dim])
return tf.tile([[0.0]], [batch_size, output_dim])

0 comments on commit 7dab3b4

Please sign in to comment.