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

[RLlib] Add addtional_update to RL Trainer #31541

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

avnishn
Copy link
Member

@avnishn avnishn commented Jan 9, 2023

Signed-off-by: Avnish avnishnarayan@gmail.com

Add the additional updates function to the RL-Trainer.

For example, it could be used to do a polyak averaging update
of a target network in off policy algorithms like SAC or DQN.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Avnish <avnishnarayan@gmail.com>
Copy link
Contributor

@kouroshHakha kouroshHakha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comment.

@@ -205,6 +205,14 @@ def update(self, batch: MultiAgentBatch) -> Mapping[str, Any]:
self.do_distributed_update(batch)
return self.compile_results(batch, fwd_out, loss, post_processed_gradients)

def additional_update(self) -> Mapping[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it not take in any parameters? like *args, **kwargs? what should be returned? also provide some more context on where this would get called?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, I thought there wasn't a point to adding args kwargs here because users can just do whatever they want

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then it should be *args, **kwargs to make it explicit. But the returned value should have some explaination.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Avnish <avnishnarayan@gmail.com>
@gjoliver gjoliver merged commit 913ab73 into ray-project:master Jan 9, 2023
AmeerHajAli pushed a commit that referenced this pull request Jan 12, 2023
Signed-off-by: Avnish <avnishnarayan@gmail.com>
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.

3 participants