Skip to content

[Hackathon 7th] fix aishell3/vctk vc0/ernie #3928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion paddlespeech/t2s/modules/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,8 @@ def forward(
paddle.reshape(xs_pad, (-1, self.odim))),
axis=-1)
mlm_loss = paddle.sum((loss * paddle.reshape(
mlm_loss_pos, [-1]))) / paddle.sum((mlm_loss_pos) + 1e-10)
mlm_loss_pos,
[-1]).astype(loss.dtype))) / paddle.sum((mlm_loss_pos) + 1e-10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the data format of loss and mlm_loss_pos? paddle.sum((mlm_loss_pos) + 1e-10) don't need a .astype?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mlm_loss_pos 大概是个 bool


text_mlm_loss = None

Expand Down
7 changes: 4 additions & 3 deletions paddlespeech/t2s/modules/nets_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def phones_masking(xs_pad: paddle.Tensor,
for s, e in zip(masked_start, masked_end):
masked_pos[idx, s:e] = 1
non_eos_mask = paddle.reshape(src_mask, paddle.shape(xs_pad)[:2])
masked_pos = masked_pos * non_eos_mask
masked_pos = masked_pos * non_eos_mask.astype(masked_pos.dtype)
masked_pos = paddle.cast(masked_pos, 'bool')

return masked_pos
Expand Down Expand Up @@ -549,10 +549,11 @@ def phones_text_masking(xs_pad: paddle.Tensor,
for s, e in zip(masked_start, masked_end):
masked_pos[idx, s:e] = 1
non_eos_mask = paddle.reshape(src_mask, shape=paddle.shape(xs_pad)[:2])
masked_pos = masked_pos * non_eos_mask
masked_pos = masked_pos * non_eos_mask.astype(masked_pos.dtype)
non_eos_text_mask = paddle.reshape(
text_mask, shape=paddle.shape(text_pad)[:2])
text_masked_pos = text_masked_pos * non_eos_text_mask
text_masked_pos = text_masked_pos * non_eos_text_mask.astype(
text_masked_pos.dtype)
masked_pos = paddle.cast(masked_pos, 'bool')
text_masked_pos = paddle.cast(text_masked_pos, 'bool')

Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/modules/tacotron2/attentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def forward(
if paddle.sum(att_prev) == 0:
# if no bias, 0 0-pad goes 0
att_prev = 1.0 - make_pad_mask(enc_hs_len)
att_prev = att_prev / enc_hs_len.unsqueeze(-1)
att_prev = att_prev / enc_hs_len.unsqueeze(-1).astype(att_prev.dtype)

# att_prev: (utt, frame) -> (utt, 1, 1, frame)
# -> (utt, att_conv_chans, 1, frame)
Expand Down
2 changes: 2 additions & 0 deletions paddlespeech/t2s/modules/tacotron2/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def forward(self, xs, ilens=None):
return xs.transpose([0, 2, 1])
if not isinstance(ilens, paddle.Tensor):
ilens = paddle.to_tensor(ilens)
if ilens.ndim == 0:
ilens = ilens.unsqueeze(0)
xs = xs.transpose([0, 2, 1])
# for dygraph to static graph
# self.blstm.flatten_parameters()
Expand Down