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] APPO accelerate (vol 10): Some torch distribution enhancements. #50440

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Feb 11, 2025

APPO accelerate (vol 10): Some torch distribution enhancements.

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 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 :(

Signed-off-by: sven1977 <[email protected]>
Copy link
Collaborator

@simonsays1980 simonsays1980 left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -141,7 +143,7 @@ def required_input_dim(space: gym.Space, **kwargs) -> int:
def rsample(self, sample_shape=()):
if self._one_hot is None:
self._one_hot = torch.distributions.one_hot_categorical.OneHotCategorical(
logits=self.logits, probs=self.probs
logits=self.logits, probs=self.probs, validate_args=False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting. So validation takes a long time? Shall we by time introduce a general configuration argument validate_args that includes validations in all such methods, like here and in gymnasium, etc.? Such it helps users in finding bugs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should, yeah. Then again, don't want to add too much second-layer/wrapped config args.

I think the ultimate goal should be to try and use torch.distributions directly (in custom and default RLModules) without the RLlib wrappers.

@sven1977 sven1977 enabled auto-merge (squash) February 12, 2025 11:56
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Feb 12, 2025
@sven1977 sven1977 merged commit 8a70768 into ray-project:master Feb 12, 2025
6 checks passed
@sven1977 sven1977 deleted the appo_accelerate_10_torch_distribution_enhancements branch February 13, 2025 12:55
xsuler pushed a commit to antgroup/ant-ray that referenced this pull request Mar 4, 2025
xsuler pushed a commit to antgroup/ant-ray that referenced this pull request Mar 4, 2025
park12sj pushed a commit to park12sj/ray that referenced this pull request Mar 18, 2025
jaychia pushed a commit to jaychia/ray that referenced this pull request Mar 19, 2025
jaychia pushed a commit to jaychia/ray that referenced this pull request Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants