Hey,
If you want to write a custom data loader you can check out my article : https://towardsdatascience.com/the-pytorch-training-loop-3c645c56665a 6
However, I would suggest adding the functionality to a custom dataset instead of a data loader.