def collater(self, samples):
        """
        If we are doing batch sampling, then pick the right collater to use.

        Otherwise we assume all collaters are the same.
        """
        if len(samples) == 0:
            return None
        if "full_id" in samples[0]:
            _, key = self._map_index(samples[0]["full_id"])
            try:
                batch = self.datasets[key].collater(samples)
            except Exception:
                print(f"Collating failed for key {key}", flush=True)
                raise
            return batch
        else:
            # Subclasses may override __getitem__ to not specify full_id
            return list(self.datasets.values())[0].collater(samples)

        If we are doing batch sampling, then pick the right collater to use.

        Otherwise we assume all collaters are the same.
        
understand_icl/fairseq/fairseq/data/multi_corpus_dataset.py