def truncate_seq_pair(self, tokens_a, tokens_b, max_num_tokens, np_rng):
    'Truncate sequence pair to a maximum sequence length.'
    (len_a, len_b) = (len(tokens_a), len(tokens_b))
    while True:
        total_length = (len_a + len_b)
        if (total_length <= max_num_tokens):
            break
        if (len_a > len_b):
            trunc_tokens = tokens_a
            len_a -= 1
        else:
            trunc_tokens = tokens_b
            len_b -= 1
        if (np_rng.random() < 0.5):
            trunc_tokens.pop(0)
        else:
            trunc_tokens.pop()
    return (tokens_a, tokens_b)
Truncate sequence pair to a maximum sequence length.
def truncate_seq_pair(self, tokens_a, tokens_b, max_num_tokens, np_rng):
    
    (len_a, len_b) = (len(tokens_a), len(tokens_b))
    while True:
        total_length = (len_a + len_b)
        if (total_length <= max_num_tokens):
            break
        if (len_a > len_b):
            trunc_tokens = tokens_a
            len_a -= 1
        else:
            trunc_tokens = tokens_b
            len_b -= 1
        if (np_rng.random() < 0.5):
            trunc_tokens.pop(0)
        else:
            trunc_tokens.pop()
    return (tokens_a, tokens_b)