    def collater(self, samples):
        """This collator is deprecated.
        set self.collator = MMDataset.collater.
        see collator in FairseqMMDataset.
        """

        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])
                # if torch.is_tensor(batch[key]):
                #    print(key, batch[key].size())
                # else:
                #    print(key, len(batch[key]))
            return batch
        else:
            return default_collate(samples)
This collator is deprecated.
set self.collator = MMDataset.collater.
see collator in FairseqMMDataset.
examples/MMPT/mmpt/datasets/mmdataset.py