Skip to content

Commit

Permalink
Truncate MCQ inputs from the start and not end (#1256)
Browse files Browse the repository at this point in the history
* Truncate MCQ inputs from the start and not end

In MCQ setting, the default truncation shouldn't be from the end. It has a risk of removing the question altogether. It's a better default to truncate from start so that if anything part of the context gets truncated but not the question.

Co-authored-by: jeswan <57466294+jeswan@users.noreply.github.com>
  • Loading branch information
HarshTrivedi and jeswan authored Jan 5, 2021
1 parent a88956a commit 9cfe644
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions jiant/tasks/lib/templates/multiple_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def featurize(self, tokenizer, feat_spec):
prompt, choice = truncate_sequences(
tokens_ls=[self.prompt, choice],
max_length=feat_spec.max_seq_length - special_tokens_count,
truncate_end=False,
)
unpadded_inputs = add_cls_token(
unpadded_tokens=(
Expand Down

0 comments on commit 9cfe644

Please sign in to comment.