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

Improve normalized advantage calculation #1642

Merged
merged 2 commits into from
May 15, 2024

Conversation

emailweixu
Copy link
Contributor

  1. Use LazyBatchNorm for advantage normalization.The motivation is that for DDP training, the normalization statistics will combine the statistics from all GPUs.

  2. Calculate normalized advantage in PPOAlgorithm.preprocess so that the normalization is based on a much larger batch.

1. Use LazyBatchNorm for advantage normalization.The motivation is that
for DDP training, the normalization statistics will combine the statistics from all GPUs.

2. Calculate normalized advantage in PPOAlgorithm.preprocess so that
the normalization is based on a much larger batch.
@emailweixu emailweixu requested a review from hnyu May 7, 2024 00:39
@hnyu
Copy link
Collaborator

hnyu commented May 14, 2024

  1. Calculate normalized advantage in PPOAlgorithm.preprocess so that the normalization is based on a much larger batch.

Not sure why computing normalized advantage in preprocess is based on a larger batch? Is it due to mini_batch_length smaller than full batch length?

@emailweixu
Copy link
Contributor Author

  1. Calculate normalized advantage in PPOAlgorithm.preprocess so that the normalization is based on a much larger batch.

Not sure why computing normalized advantage in preprocess is based on a larger batch? Is it due to mini_batch_length smaller than full batch length?

In preprocess, all the samples from the rollout are processed. In loss, only mini_batch_size samples are processed.

@emailweixu emailweixu merged commit f3978fa into pytorch May 15, 2024
2 checks passed
@emailweixu emailweixu deleted the PR_ppo_advantage_improvement branch May 15, 2024 16:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants