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] - Enable multi-learner setup for hybrid stack BC #46436

Conversation

simonsays1980
Copy link
Collaborator

@simonsays1980 simonsays1980 commented Jul 4, 2024

Why are these changes needed?

This PR does fix a bug in hybrid stack BC which was hindering multi-learner setups for offline RL.

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

…i-learner setups in BC impossible on the hybrid stack.

Signed-off-by: simonsays1980 <[email protected]>
@simonsays1980 simonsays1980 self-assigned this Jul 4, 2024
@simonsays1980 simonsays1980 added rllib RLlib related issues rllib-offline-rl Offline RL problems rllib-oldstack-cleanup Issues related to cleaning up classes, utilities on the old API stack labels Jul 4, 2024
Copy link
Contributor

@sven1977 sven1977 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for this fix @simonsays1980 .

@sven1977 sven1977 marked this pull request as ready for review July 4, 2024 15:43
@sven1977 sven1977 enabled auto-merge (squash) July 4, 2024 15:43
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jul 4, 2024
@github-actions github-actions bot disabled auto-merge July 8, 2024 12:06
train_results = self.learner_group.update_from_batch(
batch=train_batch.as_multi_agent(
module_id=list(self.config.policies)[0]
if self.config.policies
Copy link
Contributor

Choose a reason for hiding this comment

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

self.config.policies should always be available and you should always be able to iterate through it. So I don't think, we need this if-check here.

@@ -147,6 +147,7 @@
TRAINING_ITERATION: args.stop_iters,
}

args.local_mode = True
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch!

@@ -907,14 +908,20 @@ def get(self, key, default=None):
return default

@PublicAPI
def as_multi_agent(self) -> "MultiAgentBatch":
"""Returns the respective MultiAgentBatch using DEFAULT_POLICY_ID.
def as_multi_agent(self, module_id: Optional[ModuleID] = None) -> "MultiAgentBatch":
Copy link
Contributor

Choose a reason for hiding this comment

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

perfect!

…able and removed local mode from example which is a relict from debugging.

Signed-off-by: simonsays1980 <[email protected]>
@sven1977 sven1977 merged commit 14a0be7 into ray-project:master Jul 9, 2024
5 checks passed
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 rllib RLlib related issues rllib-offline-rl Offline RL problems rllib-oldstack-cleanup Issues related to cleaning up classes, utilities on the old API stack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants