Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to load RL step data in order #166

Open
JustinS6626 opened this issue Nov 16, 2023 · 1 comment
Open

[Question] How to load RL step data in order #166

JustinS6626 opened this issue Nov 16, 2023 · 1 comment

Comments

@JustinS6626
Copy link

JustinS6626 commented Nov 16, 2023

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?

@younik
Copy link
Member

younik commented Nov 17, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants