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] Unify pattern of examples and learning tests. #45023

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Apr 28, 2024

Unify examples, tuned_examples (learning tests), and release tests into a common pattern of execution.

  • Config files should become python executable scripts.
  • All these scripts/config files should have a common command line arg schema, supporting common arguments such as --wandb-key, --num-env-runners, --num-gpus, --env, etc..
  • All these scripts/config should be runnable as tests, meaning they should all define a) one or more stopping criteria, and b) (optionsl) a passing criterium. If b) is not provided, RLlib will automatically try to find a good passing criterium in the stopping criterium (try eval/episode_reward_mean first, then try episode_reward_mean)
  • Cleanup all BUILD learning_tests and tag old API stack ones as such. Remove the "_envrunner" suffix from the new API stack tuned_examples, b/c new stack should become more and more the norm.
  • Move a single release test (pong_ppo) into this new format as well (for testing purposes).

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>
…y_pattern_of_examples_and_learning_tests
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 added rllib RLlib related issues rllib-newstack labels May 2, 2024
Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests
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. The great thing about it is we can finally test all tuned examples without alw<s putting a tune.Tuner in :)

Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 requested a review from a team as a code owner May 3, 2024 13:29
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.

approval for docs change.

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.

parser = add_rllib_example_script_args()
# Use `parser` to add your own custom command line options to this script
# and (if needed) use their values toset up `config` below.
args = parser.parse_args()

register_env("multi_agent_pendulum", lambda _: MultiAgentPendulum({"num_agents": 2}))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sven1977 I think we must use here the "num_agents": args.num_agents?

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

…y_pattern_of_examples_and_learning_tests

Signed-off-by: sven1977 <svenmika1977@gmail.com>

# Conflicts:
#	rllib/BUILD
Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests
…y_pattern_of_examples_and_learning_tests
…y_pattern_of_examples_and_learning_tests
…y_pattern_of_examples_and_learning_tests
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests
…y_pattern_of_examples_and_learning_tests

Signed-off-by: sven1977 <svenmika1977@gmail.com>

# Conflicts:
#	rllib/tuned_examples/dqn/cartpole_dqn.py
#	rllib/tuned_examples/ppo/cartpole-ppo-fake-gpus.yaml
#	rllib/tuned_examples/ppo/cartpole-ppo-grid-search-example.yaml
#	rllib/tuned_examples/ppo/cartpole-ppo-hyperband.yaml
#	rllib/tuned_examples/ppo/cartpole_ppo.py
#	rllib/tuned_examples/ppo/cartpole_truncated_ppo.py
#	rllib/tuned_examples/ppo/multi_agent_pendulum_ppo.py
#	rllib/tuned_examples/ppo/pendulum_ppo.py
#	rllib/tuned_examples/ppo/recomm-sys001-ppo.yaml
#	rllib/tuned_examples/sac/pendulum_sac.py
…y_pattern_of_examples_and_learning_tests
…y_pattern_of_examples_and_learning_tests

Signed-off-by: sven1977 <svenmika1977@gmail.com>

# Conflicts:
#	rllib/tuned_examples/dqn/cartpole_dqn.py
#	rllib/tuned_examples/ppo/cartpole-ppo-fake-gpus.yaml
#	rllib/tuned_examples/ppo/cartpole-ppo-grid-search-example.yaml
#	rllib/tuned_examples/ppo/cartpole-ppo-hyperband.yaml
#	rllib/tuned_examples/ppo/cartpole_ppo.py
#	rllib/tuned_examples/ppo/cartpole_truncated_ppo.py
#	rllib/tuned_examples/ppo/multi_agent_pendulum_ppo.py
#	rllib/tuned_examples/ppo/pendulum_ppo.py
#	rllib/tuned_examples/ppo/recomm-sys001-ppo.yaml
#	rllib/tuned_examples/sac/pendulum_sac.py
Signed-off-by: sven1977 <svenmika1977@gmail.com>
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) May 16, 2024 02:29
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label May 16, 2024
…y_pattern_of_examples_and_learning_tests
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@github-actions github-actions bot disabled auto-merge May 16, 2024 14:59
Signed-off-by: sven1977 <svenmika1977@gmail.com>
…y_pattern_of_examples_and_learning_tests

Signed-off-by: sven1977 <svenmika1977@gmail.com>

# Conflicts:
#	rllib/env/env_runner_group.py
#	rllib/utils/test_utils.py
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 enabled auto-merge (squash) May 16, 2024 21:51
@sven1977 sven1977 merged commit 2329466 into ray-project:master May 16, 2024
7 checks passed
@sven1977 sven1977 deleted the unify_pattern_of_examples_and_learning_tests branch May 17, 2024 03:51
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-newstack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants