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

Fix bugs #5036

Merged
merged 2 commits into from
Sep 29, 2022
Merged
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
1 change: 1 addition & 0 deletions examples/nlp/question_answering/conf/qa_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ trainer:
num_sanity_val_steps: 0 # number of steps to perform validation steps for sanity check the validation process before starting the training, setting to 0 disables it
enable_checkpointing: False # provided by exp_manager
logger: False # provided by exp_manager
strategy: ddp

model:
tensor_model_parallel_size: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ def generate_candidates(self, labels, template_length, input_ids, attn_masks):
for i in range(input_ids.size(0)):
param_dict = {
"input_ids": input_ids[i : i + 1, : template_length[i]],
"attention_masks": attn_masks[i : i + 1, : template_length[i]],
"max_length": template_length[i] + tokens_to_generate,
"pad_token_id": self.tokenizer.tokenizer.pad_token_id,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ def generate_candidates(self, labels, template_length, input_ids, attn_masks):
for i in range(input_ids.size(0)):
param_dict = {
"input_ids": input_ids[i : i + 1, : template_length[i]],
"attention_masks": attn_masks[i : i + 1, : template_length[i]],
"max_length": template_length[i] + tokens_to_generate,
"pad_token_id": self.tokenizer.tokenizer.pad_token_id,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,10 @@ def _generate_candidates(self, input_ids, input_attn_mask, training_mask_end):
for i in range(input_ids.size(0)):
param_dict = {
"input_ids": input_ids[i : i + 1, : training_mask_end[i]],
"attention_masks": input_attn_mask[i : i + 1, : training_mask_end[i]],
"max_length": training_mask_end[i] + num_tokens_to_generate,
"pad_token_id": self.tokenizer.tokenizer.pad_token_id,
}
generated_token_ids.append(self.language_model.generate(**param_dict, skip_special_tokens=True))
generated_token_ids.append(self.language_model.generate(**param_dict))
max_length = max(max_length, generated_token_ids[-1].size(1))

# pad each generated to ensure they are of same length in dim 1, therefore stack-able
Expand Down