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] New API stack: (Multi)RLModule overhaul vol 02 (VPG RLModule, Algo, and Learner example classes). #47885

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Oct 3, 2024

New API stack: (Multi)RLModule overhaul vol 02 (VPG RLModule, Algo, and Learner example classes).
These new classes will replace the core/testing/bc_... classes and serve as:

  • simple example implementations for things like: using a shared encoder in multi-agent.
  • example for how to implement a custom Algorithm and AlgorithmConfig.
  • example for yet another custom Learner.

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 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 enabled auto-merge (squash) October 3, 2024 02:35
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Oct 3, 2024
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. Just a small nit and a deisgn question.

)

# Reduce and return collected metrics.
return self.metrics.reduce()
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's so simple now :)


@override(TorchRLModule)
def _forward_inference(self, batch, **kwargs):
with torch.no_grad():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

def _common_forward(self, batch):
# Features can be found in the batch under the "encoder_features" key.
features = batch["encoder_features"]
logits = self.policy_head(features)
Copy link
Collaborator

Choose a reason for hiding this comment

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

self._policy_head(features)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

)

@override(MultiRLModule)
def _run_forward_pass(self, forward_fn_name, batch, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still a strange form - passing in the forward_fn_name. Why is this needed? To have a single method to be overridden in inheritance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be gone in another PR that's already in (your) review :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question!

Signed-off-by: sven1977 <svenmika1977@gmail.com>
@github-actions github-actions bot disabled auto-merge October 3, 2024 17:39
@sven1977 sven1977 enabled auto-merge (squash) October 3, 2024 17:55
@github-actions github-actions bot disabled auto-merge October 4, 2024 20:55
@sven1977 sven1977 enabled auto-merge (squash) October 4, 2024 22:22
@sven1977 sven1977 merged commit cbde03c into ray-project:master Oct 4, 2024
6 checks passed
@sven1977 sven1977 deleted the rl_module_do_over_bc_default_module_02_pg_algo branch October 4, 2024 23:51
tinaxfwu pushed a commit to tinaxfwu/ray that referenced this pull request Oct 5, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: Tina Wu <j6vupz97@gmail.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Oct 15, 2024
… Algo, and Learner example classes). (ray-project#47885)

Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
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