In your case, loading the dataset involves loading two numpy arrays and storing them in self.x and self.y respectively. Once the dataset is loaded, retrieving the elements is a fast operation. Hence, the reason for slow training could be something else in your training process (e.g. model forward pass) . Check each step in your training loop, or post the training loop and the model here so that we can help you further.
Thank you for reply.
Actually, I’m using pytorch-lightning framework so it maybe not good question for here but the code is similiar to pytorch so the pytorch user can give me some advice.
Here is my training code (validation and test code is same):