Skip to content

Commit

Permalink
Update i6_models/parts/best_rq/mask.py
Browse files Browse the repository at this point in the history
Co-authored-by: michelwi <[email protected]>
  • Loading branch information
Judyxujj and michelwi authored Dec 4, 2024
1 parent b34b1dc commit b50b66e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions i6_models/parts/best_rq/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ def forward(
min_len = seq_len - num_mask - 1
mask_idc = np.random.choice(seq_len - min_len, num_mask, replace=False)

mask_idc = np.asarray(
[mask_idc[j] + offset for j in range(len(mask_idc)) for offset in range(self.mask_length)]
)
mask_idcs.append(mask_idc)

for i, mask_idc in enumerate(mask_idcs):
mask[i, mask_idc] = True
for j in mask_idc:
mask[i, j : j+self.mask_length] = True

tensor[mask] = self.mask_emb.to(tensor.device)

Expand Down

0 comments on commit b50b66e

Please sign in to comment.