Skip to content

Commit

Permalink
Updates for PyTorch 1.2 masking/bool behavior
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: fairinternal/fairseq-py#821

Differential Revision: D16790120

Pulled By: myleott

fbshipit-source-id: 2fb5070172636561d08596a29f08c93df07548bf
  • Loading branch information
myleott authored and facebook-github-bot committed Aug 14, 2019
1 parent d015d23 commit baa8ce1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fairseq/data/mask_tokens_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __getitem__(self, index: int):
if self.mask_whole_words is not None:
mask = np.repeat(mask, word_lens)
new_item = np.full(len(mask), self.pad_idx)
new_item[mask] = item[torch.from_numpy(mask.astype(np.uint8))]
new_item[mask] = item[torch.from_numpy(mask.astype(np.uint8)) == 1]
return torch.from_numpy(new_item)

# decide unmasking and random replacement
Expand Down

0 comments on commit baa8ce1

Please sign in to comment.