How do I split a custom dataset into training and test datasets with SubsetRandomSampler?

It seems you have already created the custom Dataset to load all data.
Now you could create the indices for all samples e.g. using torch.arange(len(dataset)). You could then split these indices into training, validation, as well as test indices, and pass these indices to SubsetRandomSampler. These samplers can then be passed to DataLoaders to create the training, validation, and test loaders.