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

Dataloader always drop last batch in PPO #998

Closed
allanj opened this issue Nov 15, 2023 · 4 comments
Closed

Dataloader always drop last batch in PPO #998

allanj opened this issue Nov 15, 2023 · 4 comments

Comments

@allanj
Copy link
Contributor

allanj commented Nov 15, 2023

dataloader = torch.utils.data.DataLoader(
dataset,
batch_size=self.config.batch_size,
collate_fn=data_collator,
shuffle=True,
drop_last=True,
)

Is this expected?

I believe we should have an option for that?

@younesbelkada
Copy link
Contributor

Hi @allanj Yes this is expected to avoid some issues we had in the past, please check out this PR: #154 for more details

@allanj
Copy link
Contributor Author

allanj commented Nov 16, 2023

Thanks. I just checked. Is it better to let the developer pass in the data loader in that case? XD. In my experiments, I prefer to go through all the batches.

Not sure if there are more elegant ways for me to do that

@younesbelkada
Copy link
Contributor

Thanks!
I think in all cases you need to drop the last batch to avoid issues such as: #148 , this is because of the way PPOTrainer has been designed :/
To make sure you pass all your batches perhaps you can just have a dataset that has a multiple of batch_size examples and you add a single dummy instance to it at the end to that it gets dropped.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

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