I want to create a dataloader with batches containing data from 1 dataset. I have 2 datasets
train_data = TensorDataset(train_sn, train_sm, train_tt, train_y)
scaffold_data = TensorDataset(sca_txt, sca_att, sca_y)
I want to create a single dataloader for these 2 dataset such that a batch contains data from either 1 dataset but not both. Also I want to shuffle the batches among themselves. That is it shouldn’t be like all batches from 1 dataset followed by batches from other dataset while training.
I tried this
dataset_3 = torch.utils.data.ConcatDataset((train_data,scaffold_data))
dataloader = DataLoader(dataset_3, batch_size=16)
But here batches are not shuffled. So it defeats my purpose. My main goal is to train a Multitask NLP Network with both these dataset