I am working on a project which involves implementing RNNs from scratch. As we know, training huge RNNs is a time-consuming task, but I am also facing a problem with optimizing dataset import.
For my project work, I have customized torch.utils.data.Dataset as:
class MakeDataset(Dataset):
    def __init__(self, data):
        self.strings = list(data['string'])
        self.valid = list(data['valid'])
        self.len = len(self.valid)
        self.valid_list = [0, 1]

    def __getitem__(self, index):
        return self.strings[index], self.valid[index]

    def __len__(self):
        return self.len

Following is how I generate dataloaders for use in training:
train = MakeDataset(train_data)
test = MakeDataset(test_data)
train_loader = DataLoader(dataset=train, batch_size=batch_size, shuffle=True)
test_loader = DataLoader(dataset=test, batch_size=batch_size, shuffle=True)

As of now, these methods are working perfectly without any errors.
The problem arises when trying to train my model on Cuda. My GPU utilization is around 15% while the CPU is at maximum. I believe this affecting the speed of my training.
I read various answers on the forum about loading the dataset on the GPU, but none of which are working for me. It would be a great help if someone could point out a better way to do this.