class_docstr: A wrapper class for MMDataset for fairseq.
class_docstr_tok: ["A","wrapper","class","for","MMDataset","for","fairseq","."]
code: def collater(self, samples):
      if hasattr(self.mmdataset, "collator"):
          return self.mmdataset.collator(samples)
      if len(samples) == 0:
          return {}
      if isinstance(samples[0], dict):
          batch = OrderedDict()
          for key in samples[0]:
              if samples[0][key] is not None:
                  batch[key] = default_collate(
                      [sample[key] for sample in samples]
                  )
          return batch
      else:
          return default_collate(samples)
  
file_path: fairseq/examples/MMPT/mmpt/datasets/fairseqmmdataset.py
imports: from collections import OrderedDict
  from torch.utils.data import Dataset
  from torch.utils.data.dataloader import default_collate
  from fairseq.data import FairseqDataset, data_utils
label_desc: Use image node_id 5 for calling the FairseqMMDataset obj's underlying member method code with example usage: obj.collater(samples) and returns: self, dict, batch, default_collate