-
Notifications
You must be signed in to change notification settings - Fork 505
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
Fix DDP Reduction in PyTorch 1.7 when the model has unused parameters #586
Conversation
habitat_baselines/rl/ppo/ppo.py
Outdated
@@ -152,6 +152,13 @@ def update(self, rollouts: RolloutStorage) -> Tuple[float, float, float]: | |||
|
|||
return value_loss_epoch, action_loss_epoch, dist_entropy_epoch | |||
|
|||
def evaluate_actions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc string will be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a little doc string and made it internal since it just exists to be overridden with inheritance.
@mathfac @Skylion007 does this test look reasonable? It's a little ugly but I wanted it to be as close to testing the actual code path used in training as possible. |
Yes, looks good. |
…facebookresearch#586) * Hacky thing to interface with ddp.forward * State guard * Add unit test and comment in readme about it.
…facebookresearch#586) * Hacky thing to interface with ddp.forward * State guard * Add unit test and comment in readme about it.
Motivation and Context
PyTorch 1.7 slightly changed the way Reducer should be used when the model has unused parameters, leading to DD-PPO breaking when the model does, why this is certainly an edge case, it is a problem.
This PR solve this and attempts to solve future issues by using a wrapper to interface with DDP's forward call instead of using the undocumented Reducer APIs. While I am not sure if this won't cause it's own issues since it is kinda hacky, this seems like it has the potential to be better.
How Has This Been Tested
Tested on a model with unused parameters. I will write a test for this before merging this, but don't have time today.
Types of changes