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] AlgorithmConfig cleanup 03: Cleaner names and structuring of API-stack config settings. #44920

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Apr 23, 2024

AlgorithmConfig cleanup 03:

  • AlgorithmConfig.experimental(_enable_new_api_stack=...) renamed to AlgorithmConfig.api_stack(enable_rl_module_and_learner).
  • env_runner_cls=SingleAgentEnvRunner|MultiAgentEnvRunner automated to AlgorithmConfig.api_stack(enable_env_runner_and_connector_v2=True)
  • Cleanup remaining already soft-deprecated num_rollout_workers and replace with the new num_env_runners setting.

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]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
@sven1977 sven1977 changed the title [WIP; DO NOT MERGE RLlib] AlgorithmConfig cleanup 03: Cleaner namings and structuring of API-stack config settings. [RLlib] AlgorithmConfig cleanup 03: Cleaner names and structuring of API-stack config settings. Apr 25, 2024
@sven1977 sven1977 marked this pull request as ready for review April 25, 2024 20:59
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
@sven1977 sven1977 requested a review from a team as a code owner April 25, 2024 21:12
Copy link
Collaborator

@aslonnie aslonnie left a comment

Choose a reason for hiding this comment

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

I am just blindly trusting you Sven (as a doc reviewer)

…rithm_config_cleanup_03_new_api_stack_settings
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. Great change!

@@ -113,7 +113,7 @@ def __init__(self, *args, **kwargs):

config = (
PPOConfig()
.experimental(_enable_new_api_stack=True)
.api_stack(enable_rl_module_and_learner=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh yes, I feel the new power rising! :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, me, too. EnvRunners growing to become adults :D

# This enables the use of
# a) RLModule (replaces ModelV2) and Learner (replaces Policy)
# b) and automatically picks the correct EnvRunner (single-agent vs multi-agent)
# and enables ConnectorV2 support.
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, if a user overrides the SingleAgentEnvRunner , she still can pass it into Algorithm.env_runners?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you can bring your own EnvRunner sub-class as you like.
See e.g. rllib.algorithms.tests.test_worker_failures, which uses sub-classes of SingleAgentEnvRunner and MultiAgentEnvRunner.

self.experimental(
_enable_new_api_stack=config_dict["_enable_new_api_stack"]
)
enable_rl_module_and_learner = config_dict.get(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this? Imo users using still this "old" form must switch anyways in near future - so they could do it now. It's a small change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's mostly for ourselves :|
Some scripts of ours work for both API stacks and we don't want to make the exploration_config dependent on this. I'm fully with you: This is currently very hackish and should be cleaned up. I'll create another PR to see, what the impact would be for our code base (and tests), if we get rid of this hack.

Signed-off-by: sven1977 <[email protected]>
…rithm_config_cleanup_03_new_api_stack_settings
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
@sven1977 sven1977 merged commit 2ca00e0 into ray-project:master Apr 27, 2024
5 checks passed
@sven1977 sven1977 deleted the algorithm_config_cleanup_03_new_api_stack_settings branch April 27, 2024 10:13
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