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

Some problems about Bert #40

Open
tfighting opened this issue Nov 6, 2019 · 2 comments
Open

Some problems about Bert #40

tfighting opened this issue Nov 6, 2019 · 2 comments

Comments

@tfighting
Copy link

line 70: index = randint(0, vocab_size - 1) # random index in vocabulary.
I think the replace index can't involve 'cls' ,'sep' and 'mask'!

@bruce1408
Copy link

line 70: index = randint(0, vocab_size - 1) # random index in vocabulary.
I think the replace index can't involve 'cls' ,'sep' and 'mask'!

Yes, it`s right. so the code should change like this :

if random() < 0.8:  # 80%
    input_ids[pos] = word_dict['[MASK]']  # make mask
elif random() > 0.9:
    index = randint(0, vocab_size - 1)
    while index < 4: # cause {'[PAD]': 0, '[CLS]': 1, '[SEP]': 2, '[MASK]': 3} are all  meanless
        index = randint(0, vocab_size - 1)
    input_ids[pos] = index

@lukysummer
Copy link

How about just :
index = randint(4, vocab_size - 1)

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

3 participants