additionally to @ptrblck 's answer, I also used another method for my 2nd dataset: I made a Python script that reads my entire dataset and then saves each training example in a single file, then in my DataLoader I implement the loading of one training example. So, now, the DataLoader will take care of loading just “batch_size” number of examples to memory, instead of the whole dataset.