From d811d659209c236e16dac08e627db486f8f114cf Mon Sep 17 00:00:00 2001 From: Sven Mika Date: Tue, 29 Dec 2020 15:27:59 -0500 Subject: [PATCH] [RLlib] run_regression_tests.py: --framework flag (instead of --torch). (#13097) --- rllib/BUILD | 34 ++++++++++++++--------------- rllib/tests/run_regression_tests.py | 19 ++++++++++++---- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/rllib/BUILD b/rllib/BUILD index c5a109555..226abebfe 100644 --- a/rllib/BUILD +++ b/rllib/BUILD @@ -59,7 +59,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/a3c/cartpole-a2c.yaml"], - args = ["--yaml-dir=tuned_examples/a3c", "--torch"] + args = ["--yaml-dir=tuned_examples/a3c", "--framework=torch"] ) py_test( @@ -79,7 +79,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/a3c/cartpole-a3c.yaml"], - args = ["--yaml-dir=tuned_examples/a3c", "--torch"] + args = ["--yaml-dir=tuned_examples/a3c", "--framework=torch"] ) # APPO @@ -106,7 +106,7 @@ py_test( "tuned_examples/ppo/cartpole-appo.yaml", "tuned_examples/ppo/cartpole-appo-vtrace.yaml" ], - args = ["--yaml-dir=tuned_examples/ppo", "--torch"] + args = ["--yaml-dir=tuned_examples/ppo", "--framework=torch"] ) # ARS @@ -127,7 +127,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/ars/cartpole-ars.yaml"], - args = ["--yaml-dir=tuned_examples/ars", "--torch"] + args = ["--yaml-dir=tuned_examples/ars", "--framework=torch"] ) # DDPG @@ -148,7 +148,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = glob(["tuned_examples/ddpg/pendulum-ddpg.yaml"]), - args = ["--torch", "--yaml-dir=tuned_examples/ddpg"] + args = ["--yaml-dir=tuned_examples/ddpg", "--framework=torch"] ) # DDPPO @@ -159,7 +159,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = glob(["tuned_examples/ppo/cartpole-ddppo.yaml"]), - args = ["--yaml-dir=tuned_examples/ppo", "--torch"] + args = ["--yaml-dir=tuned_examples/ppo", "--framework=torch"] ) # DQN/Simple-Q @@ -190,7 +190,7 @@ py_test( "tuned_examples/dqn/cartpole-dqn-softq.yaml", "tuned_examples/dqn/cartpole-dqn-param-noise.yaml", ], - args = ["--yaml-dir=tuned_examples/dqn", "--torch"] + args = ["--yaml-dir=tuned_examples/dqn", "--framework=torch"] ) # ES @@ -211,7 +211,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/es/cartpole-es.yaml"], - args = ["--yaml-dir=tuned_examples/es", "--torch"] + args = ["--yaml-dir=tuned_examples/es", "--framework=torch"] ) # IMPALA @@ -232,7 +232,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/impala/cartpole-impala.yaml"], - args = ["--yaml-dir=tuned_examples/impala", "--torch"] + args = ["--yaml-dir=tuned_examples/impala", "--framework=torch"] ) # Working, but takes a long time to learn (>15min). @@ -266,7 +266,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/pg/cartpole-pg.yaml"], - args = ["--yaml-dir=tuned_examples/pg", "--torch"] + args = ["--yaml-dir=tuned_examples/pg", "--framework=torch"] ) # PPO @@ -287,7 +287,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/ppo/cartpole-ppo.yaml"], - args = ["--yaml-dir=tuned_examples/ppo", "--torch"] + args = ["--yaml-dir=tuned_examples/ppo", "--framework=torch"] ) py_test( @@ -307,7 +307,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/ppo/pendulum-ppo.yaml"], - args = ["--torch", "--yaml-dir=tuned_examples/ppo"] + args = ["--yaml-dir=tuned_examples/ppo", "--framework=torch"] ) py_test( @@ -327,7 +327,7 @@ py_test( size = "medium", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/ppo/repeatafterme-ppo-lstm.yaml"], - args = ["--torch", "--yaml-dir=tuned_examples/ppo"] + args = ["--yaml-dir=tuned_examples/ppo", "--framework=torch"] ) # SAC @@ -358,7 +358,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/sac/cartpole-sac.yaml"], - args = ["--yaml-dir=tuned_examples/sac", "--torch"] + args = ["--yaml-dir=tuned_examples/sac", "--framework=torch"] ) py_test( @@ -368,7 +368,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/sac/cartpole-continuous-pybullet-sac.yaml"], - args = ["--yaml-dir=tuned_examples/sac", "--torch"] + args = ["--yaml-dir=tuned_examples/sac", "--framework=torch"] ) py_test( @@ -388,7 +388,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/sac/pendulum-sac.yaml"], - args = ["--yaml-dir=tuned_examples/sac", "--torch"] + args = ["--yaml-dir=tuned_examples/sac", "--framework=torch"] ) @@ -410,7 +410,7 @@ py_test( size = "large", srcs = ["tests/run_regression_tests.py"], data = ["tuned_examples/ddpg/pendulum-td3.yaml"], - args = ["--yaml-dir=tuned_examples/ddpg", "--torch"] + args = ["--yaml-dir=tuned_examples/ddpg", "--framework=torch"] ) diff --git a/rllib/tests/run_regression_tests.py b/rllib/tests/run_regression_tests.py index 9a2c33137..3f42147e4 100644 --- a/rllib/tests/run_regression_tests.py +++ b/rllib/tests/run_regression_tests.py @@ -25,17 +25,25 @@ import yaml import ray from ray.tune import run_experiments from ray.rllib import _register_all +from ray.rllib.utils.deprecation import deprecation_warning parser = argparse.ArgumentParser() parser.add_argument( - "--torch", - action="store_true", - help="Runs all tests with PyTorch enabled.") + "--framework", + choices=["jax", "tf2", "tf", "tfe", "torch"], + default="tf", + help="The deep learning framework to use.") parser.add_argument( "--yaml-dir", type=str, help="The directory in which to find all yamls to test.") +# Obsoleted arg, use --framework=torch instead. +parser.add_argument( + "--torch", + action="store_true", + help="Runs all tests with PyTorch enabled.") + if __name__ == "__main__": args = parser.parse_args() @@ -69,8 +77,11 @@ if __name__ == "__main__": # Add torch option to exp configs. for exp in experiments.values(): + exp["config"]["framework"] = args.framework if args.torch: + deprecation_warning(old="--torch", new="--framework=torch") exp["config"]["framework"] = "torch" + args.framework = "torch" # Print out the actual config. print("== Test config ==") @@ -82,7 +93,7 @@ if __name__ == "__main__": for i in range(3): try: ray.init(num_cpus=5) - trials = run_experiments(experiments, resume=False, verbose=1) + trials = run_experiments(experiments, resume=False, verbose=2) finally: ray.shutdown() _register_all()