I would also load the data lazily as @string111 suggested. Especially in the beginning when you are experimenting with different hyperparameters it can take a lot of time to load the whole dataset just to realize after a few iterations that your model won’t learn anything.