Skip to content

Fix various small problems #367

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion megatron/data/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,16 @@ def create_masked_lm_predictions(tokens,
continue
# Note(mingdachen):
# Skip current piece if they are covered in lm masking or previous ngrams.
is_covered = False
for index_set in cand_index_set[0]:
for index in index_set:
if index in covered_indexes:
continue
is_covered = True
break
if is_covered:
break
if is_covered:
continue

if not geometric_dist:
n = np_rng.choice(ngrams[:len(cand_index_set)],
Expand Down
2 changes: 1 addition & 1 deletion megatron/tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def __init__(self, vocab_file, merge_file):

@property
def vocab_size(self):
return len(self.tokenizer.encoder)
return len(self.tokenizer)

@property
def vocab(self):
Expand Down
2 changes: 1 addition & 1 deletion tasks/eval_harness/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _collate(x):
for _, context_enc, continuation_enc in chunk:
# when too long to fit in context, truncate from the left
inp = torch.tensor(
(context_enc + continuation_enc)[-(self.max_length + 1):][:-1]
(context_enc + continuation_enc)[-(self.max_length + 1):]
, dtype=torch.long).to(self.device)
inplen, = inp.shape

Expand Down