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] Fixed a bug with kl divergence calculation of torch.Dirichlet distribution within RLlib #34209

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

kouroshHakha
Copy link
Contributor

@kouroshHakha kouroshHakha commented Apr 10, 2023

Why are these changes needed?

context:
https://discuss.ray.io/t/passing-custom-action-dist/10111

The fix, basically lets the class inherit the default behavior of the parent for computing the kl_divergence which is the correct way of doing it.
self.dist.kl_divergence is not a valid api, instead we should use torch.distributions.kl.kl_divergence(self.dist, other.dist)

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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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 :(

… distribution within RLlib

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Copy link
Member

@avnishn avnishn left a comment

Choose a reason for hiding this comment

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

is there a corresponding test?

Or do you need to merge as is?

@kouroshHakha
Copy link
Contributor Author

is there a corresponding test?

Or do you need to merge as is?

I didn't want to spend more time on writing a test for this. The current test suite that we have for action distribution is not written elegantly and is not readily applicable to this. So it will be a time sink. IMO, we need to instead put that effort in testing our new distribution suite properly.

@gjoliver gjoliver merged commit 4168b9b into ray-project:master Apr 11, 2023
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
… distribution within RLlib (ray-project#34209)

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: elliottower <[email protected]>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
… distribution within RLlib (ray-project#34209)

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Jack He <[email protected]>
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