docstr: Truncates a sequence pair in place to the maximum length.
docstr_tok: ["Truncates","a","sequence","pair","in","place","to","the","maximum","length","."]
code: def _truncate_seq_pair(
      self, tokens_a: List[str], tokens_b: List[str], max_length: int
  ):
      """Truncates a sequence pair in place to the maximum length."""
      if tokens_b is None:
          tokens_b = []
          max_length -= 2
      else:
          # _convert_to_indices does <s> tokens_a </s> </s> tokens_b </s>
          max_length -= 4
      assert max_length >= 0, (
          "Max length should be minimum 2 in case of single sentence"
          + " and 4 in case of two sentences."
      )
  
      while True:
          total_length = len(tokens_a) + len(tokens_b)
          if total_length <= max_length:
              break
          if len(tokens_a) > len(tokens_b):
              tokens_a.pop()
          else:
              tokens_b.pop()
  
imports: import copy
  import random
  from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from mmf.common.registry import registry
  from mmf.common.sample import Sample, SampleList
  from mmf.datasets.processors.processors import BaseProcessor
label_desc: Use image node_id 2 for calling the MaskedRobertaTokenizer obj's underlying member method code with example usage: obj._truncate_seq_pair(tokens_a, tokens_b, max_length) without return types