My bad: I didn’t see the file was scrollable and therefore didn’t see the second part of the code. Thanks for not jumping at me 
In that case, I fear it’s too complex to do it your way. You would need an additional argument to __getitem__(self, idx, transform=False), but then who calls __getitem__ and how do you pass the additional argument to it? My guess is that you would need to pass the transform argument all the way from the DataLoader down to the thing actually iterating on the dataset, which gets really complicated with all the multiprocessing aspects of DataLoader…
IMHO, the easiest way is to split the dataset first… Maybe someone else can provide a quick hack for this instead of overriding a lot of code?