How to load data efficiently in online learning

I’m working in the reinforcement learning. In RL, we need to grow the replay buffer and draw samples in an online manner.

I can’t figure out a way to use the DataLoader and Sampler concepts in PyTorch. They seem to only support batch training.

You must make your own replay buffer by hand (because the quality of RL sometimes strongly depends on the quality of the buffer, you can’t impose a generic method). However, the most standard approach (not the most efficient) is to save the last 1e6 examples of transitions and to uniformly sample from them. You have one simple example here: