mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-11 06:55:27 +00:00
Don't always apply the frame mask
This commit is contained in:
parent
0685ac792d
commit
02eb7af824
@ -330,6 +330,14 @@ class ConformerEncoder(nn.Module):
|
|||||||
# frame_mask is 0 with probability `feature_mask_dropout_prob`
|
# frame_mask is 0 with probability `feature_mask_dropout_prob`
|
||||||
# frame_mask shape: (S, N, 1)
|
# frame_mask shape: (S, N, 1)
|
||||||
frame_mask = (torch.rand_like(src[...,:1]) > feature_mask_dropout_prob).to(src.dtype)
|
frame_mask = (torch.rand_like(src[...,:1]) > feature_mask_dropout_prob).to(src.dtype)
|
||||||
|
|
||||||
|
# for 10% of sequences, make the frame mask always-1, i.e. don't drop out any of
|
||||||
|
# the frames. This is to make sure the model sometimes "sees" the same types of
|
||||||
|
# un-perturbed sequences that it will see in test time.
|
||||||
|
frame_mask = torch.logical_or(frame_mask,
|
||||||
|
torch.rand_like(src[:,:1,:1]) < 0.1)
|
||||||
|
|
||||||
|
|
||||||
feature_mask[..., feature_unmasked_dim:] *= frame_mask
|
feature_mask[..., feature_unmasked_dim:] *= frame_mask
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user