Minari icon indicating copy to clipboard operation
Minari copied to clipboard

[Question] How to load RL step data in order

Open JustinS6626 opened this issue 1 year ago • 1 comments

Question

I have just created a dataset from the deployment of an agent on the Farama Minigrid environment, and I am wondering how to ensure that when data is loaded from the dataset, it is done in the original order, without any steps being loaded redundantly. Is there a way to do that with the pytorch DataLoader class? For instance, given the example shown here https://minari.farama.org/content/basic_usage/, how would I go about getting batches from the DataLoader such that the steps given in the batches were in the same order as that in which they were created when the agent was deployed on the environment? Also, is there a way that I can do that without any of the steps being repeated?

JustinS6626 avatar Nov 16 '23 18:11 JustinS6626

Hello @JustinS6626,

If you use dataset.iterate_episodes() the episodes are in the same order that you had during collecting, and the trajectory as well of course.

If you use DataLoader (see here for an example) you have to ensure that shuffling is off.

We don't allow sampling of partial trajectories for now, so in that case, you have to code it by yourself.

Does this answer your question?

younik avatar Nov 17 '23 21:11 younik