Skip to content
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

Question about the MLM masking #16

Closed
longkukuhi opened this issue Sep 13, 2022 · 1 comment
Closed

Question about the MLM masking #16

longkukuhi opened this issue Sep 13, 2022 · 1 comment

Comments

@longkukuhi
Copy link

Hi,

10% of the time, we replace masked input tokens with random word

    indices_random = torch.bernoulli(torch.full(input_ids.shape, 0.5)).bool() & masked_indices & ~indices_replaced

Here is the code you use to replace a token with a random word. Is it correct to use 0.5 as the parameter here?
Thank you for your answer.

@viyjy
Copy link
Collaborator

viyjy commented Sep 16, 2022

Thanks for your interest in our work.
As shown in this Line, there is ~indices_replaced to make sure only 10% are replaced by random word.
You can reorder this line as:
indices_random = torch.bernoulli(torch.full(input_ids.shape, 0.5)).bool() & ~indices_replaced & masked_indices
Please let me know if you might have any other questions.

@viyjy viyjy closed this as completed Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants