You can define a class, and for every step, you just read the data you need with the dataloader. For more information, you can read the tutorial below:
https://pytorch.org/tutorials/beginner/data_loading_tutorial.html 256
Best wishes.