Skip to content
ml-recall

#truncation

1 question from NLP Tasks

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

easyAI-checkedNLP Tasks

A BERT fine-tuning dataset truncates each (premise, hypothesis) pair like this:

def _truncate_pair_of_tokens(self, p_tokens, h_tokens):
    # Reserve slots for '<CLS>', '<SEP>', and '<SEP>'
    while len(p_tokens) + len(h_tokens) > self.max_len - 3:
        if len(p_tokens) > len(h_tokens):
            p_tokens.pop()
        else:
            h_tokens.pop()

With max_len = 32, a premise of 40 tokens and a hypothesis of 10 tokens, how many premise tokens remain?

a whole number