def get_data_loader(self, dataset, sampler): pad_collate = PadCollate(dim=-1, sp_dim=-2, sp_item_idx=[ 3, 8, 12, 14 ]) # nwp_index, spt_tgt need special padding data_loader = DataLoader(dataset, sampler=sampler, batch_size=self.batch_size, collate_fn=pad_collate) return data_loader
def get_data_loader(self, features): dataset = FewShotDataset([self.unpack_feature(f) for f in features]) if self.opt.local_rank == -1: sampler = SequentialSampler(dataset) else: sampler = DistributedSampler(dataset) pad_collate = PadCollate(dim=-1, sp_dim=-2, sp_item_idx=[3, 8, 12]) # nwp_index, spt_tgt need special padding data_loader = DataLoader(dataset, sampler=sampler, batch_size=self.batch_size, collate_fn=pad_collate) return data_loader
def get_data_loader(self, dataset, sampler): """ add label index into special padding """ pad_collate = PadCollate(dim=-1, sp_dim=-2, sp_item_idx=[3, 9, 14, 16, 20, 25]) # nwp_index, spt_tgt need sp-padding data_loader = DataLoader(dataset, sampler=sampler, batch_size=self.batch_size, collate_fn=pad_collate) return data_loader