docstr: Preprocess the sample list elements and return a Dict[str, Dict[str, Tensor]]
  object. This object standardizes how we represent multiple modalities. Check
  the definition of this in BaseTransformer.
  
  Returns:
      Dict[str, Dict[str, Tensor]]: containing input_ids, position_ids,
          segment_ids, masks and mlm_labels
  
          input_ids: dict of input ids for all modalities
          position_ids: dict of position ids for all modalities
          segment_ids: dict of segment/token type ids for all modalities
          masks: dict of masks for all modalities
          mlm_labels: dict of mlm labels for all modalities, also contains
              key `combined_labels` which is a concatenation of all labels
              in order of modalities
docstr_tok: ["Preprocess","the","sample","list","elements","and","return","a","Dict","[","str",",","Dict","[","str",",","Tensor","]","]","object",".","This","object","standardizes","how","we","represent","multiple","modalities",".","Check","the","definition","of","this","in","BaseTransformer",".","Returns",":","Dict","[","str",",","Dict","[","str",",","Tensor","]","]",":","containing","input_ids",",","position_ids",",","segment_ids",",","masks","and","mlm_labels","input_ids",":","dict","of","input","ids","for","all","modalities","position_ids",":","dict","of","position","ids","for","all","modalities","segment_ids",":","dict","of","segment\/token","type","ids","for","all","modalities","masks",":","dict","of","masks","for","all","modalities","mlm_labels",":","dict","of","mlm","labels","for","all","modalities",",","also","contains","key","`","combined_labels","`","which","is","a","concatenation","of","all","labels","in","order","of","modalities"]
code: def preprocess_sample(
      self, sample_list: Dict[str, Tensor]
  ) -> Dict[str, Dict[str, Tensor]]:
      """Preprocess the sample list elements and return a Dict[str, Dict[str, Tensor]]
      object. This object standardizes how we represent multiple modalities. Check
      the definition of this in BaseTransformer.
  
      Returns:
          Dict[str, Dict[str, Tensor]]: containing input_ids, position_ids,
              segment_ids, masks and mlm_labels
  
              input_ids: dict of input ids for all modalities
              position_ids: dict of position ids for all modalities
              segment_ids: dict of segment/token type ids for all modalities
              masks: dict of masks for all modalities
              mlm_labels: dict of mlm labels for all modalities, also contains
                  key `combined_labels` which is a concatenation of all labels
                  in order of modalities
      """
  
      input_ids = self._infer_input_ids(sample_list)
      position_ids = self._infer_position_ids(input_ids)
      masks = self._infer_masks(sample_list, input_ids)
      segment_ids = self._infer_segment_ids(sample_list, input_ids)
      mlm_labels = self._infer_mlm_labels(sample_list, input_ids)
      itm_labels = self._infer_itm_labels(sample_list, input_ids)
  
      return {
          "input_ids": input_ids,
          "position_ids": position_ids,
          "segment_ids": segment_ids,
          "masks": masks,
          "mlm_labels": mlm_labels,
          "itm_labels": itm_labels,
      }
  
imports: import logging
  from dataclasses import dataclass, field
  from typing import Dict, List, Optional
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformer, BaseTransformerBackendConfig, BaseTransformerHead, BaseTransformerModalityConfig
  from mmf.models.transformers.heads.mlp import MLP
  from mmf.modules.encoders import ResNet152ImageEncoder
  from mmf.utils.build import build_encoder
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 6 for calling the MMFTransformer obj's underlying member method code with example usage: obj.preprocess_sample(sample_list) and returns: dict