The DataLoader will call into the Dataset.__getitem__ method with the current sample index.
Depending how you’ve implemented the loading and processing logic in __getitem__, it might take some time to load and process the data.
How did you implement your generator, which achieves the speedup?
Are you loading the data lazily or are you processing it at all?