mirror of
https://github.com/wassname/ray.git
synced 2026-08-01 12:51:09 +08:00
Replace --redis-address with --address in test, docs, tune, rllib (#5602)
* wip * add tests and tune * add ci * test fix * lint * fix tests * wip * sugar dep
This commit is contained in:
@@ -51,10 +51,10 @@ if __name__ == "__main__":
|
||||
parser.add_argument(
|
||||
"--smoke-test", action="store_true", help="Finish quickly for testing")
|
||||
parser.add_argument(
|
||||
"--ray-redis-address",
|
||||
"--ray-address",
|
||||
help="Address of Ray cluster for seamless distributed execution.")
|
||||
args, _ = parser.parse_known_args()
|
||||
ray.init(redis_address=args.ray_redis_address)
|
||||
ray.init(address=args.ray_address)
|
||||
|
||||
# asynchronous hyperband early stopping, configured with
|
||||
# `episode_reward_mean` as the
|
||||
|
||||
@@ -19,7 +19,7 @@ parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--smoke-test", action="store_true", help="Finish quickly for testing")
|
||||
parser.add_argument(
|
||||
"--ray-redis-address",
|
||||
"--ray-address",
|
||||
help="Address of Ray cluster for seamless distributed execution.")
|
||||
args, _ = parser.parse_known_args()
|
||||
|
||||
@@ -56,7 +56,7 @@ class MyTrainableClass(Trainable):
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ConfigSpace as CS
|
||||
ray.init(redis_address=args.ray_redis_address)
|
||||
ray.init(address=args.ray_address)
|
||||
|
||||
# BOHB uses ConfigSpace for their hyperparameter search space
|
||||
config_space = CS.ConfigurationSpace()
|
||||
|
||||
@@ -116,11 +116,11 @@ if __name__ == "__main__":
|
||||
parser.add_argument(
|
||||
"--smoke-test", action="store_true", help="Finish quickly for testing")
|
||||
parser.add_argument(
|
||||
"--ray-redis-address",
|
||||
"--ray-address",
|
||||
help="Address of Ray cluster for seamless distributed execution.")
|
||||
args = parser.parse_args()
|
||||
if args.ray_redis_address:
|
||||
ray.init(redis_address=args.ray_redis_address)
|
||||
if args.ray_address:
|
||||
ray.init(address=args.ray_address)
|
||||
sched = AsyncHyperBandScheduler(
|
||||
time_attr="training_iteration", metric="mean_accuracy")
|
||||
analysis = tune.run(
|
||||
|
||||
@@ -25,7 +25,7 @@ parser.add_argument(
|
||||
default=False,
|
||||
help="enables CUDA training")
|
||||
parser.add_argument(
|
||||
"--ray-redis-address", type=str, help="The Redis address of the cluster.")
|
||||
"--ray-address", type=str, help="The Redis address of the cluster.")
|
||||
parser.add_argument(
|
||||
"--smoke-test", action="store_true", help="Finish quickly for testing")
|
||||
|
||||
@@ -64,7 +64,7 @@ class TrainMNIST(tune.Trainable):
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
ray.init(redis_address=args.ray_redis_address)
|
||||
ray.init(address=args.ray_address)
|
||||
sched = ASHAScheduler(metric="mean_accuracy")
|
||||
analysis = tune.run(
|
||||
TrainMNIST,
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# import ray
|
||||
# import argparse
|
||||
# parser = argparse.ArgumentParser()
|
||||
# parser.add_argument("--redis-address")
|
||||
# parser.add_argument("--address")
|
||||
# args = parser.parse_args()
|
||||
# ray.init(redis_address=args.redis_address)
|
||||
# ray.init(address=args.address)
|
||||
|
||||
# __quick_start_begin__
|
||||
import torch.optim as optim
|
||||
|
||||
@@ -357,7 +357,7 @@ import time
|
||||
import ray
|
||||
from ray import tune
|
||||
|
||||
ray.init(redis_address="{redis_address}")
|
||||
ray.init(address="{address}")
|
||||
|
||||
|
||||
tune.run(
|
||||
@@ -372,7 +372,7 @@ tune.run(
|
||||
dict(experiment=kwargs),
|
||||
raise_on_failed_trial=False)
|
||||
""".format(
|
||||
redis_address=cluster.redis_address, checkpoint_dir=dirpath)
|
||||
address=cluster.address, checkpoint_dir=dirpath)
|
||||
run_string_as_driver_nonblocking(script)
|
||||
# Wait until the right checkpoint is saved.
|
||||
# The trainable returns every 0.5 seconds, so this should not miss
|
||||
@@ -446,7 +446,7 @@ import time
|
||||
import ray
|
||||
from ray import tune
|
||||
|
||||
ray.init(redis_address="{redis_address}")
|
||||
ray.init(address="{address}")
|
||||
|
||||
{fail_class_code}
|
||||
|
||||
@@ -460,7 +460,7 @@ tune.run(
|
||||
max_failures=1,
|
||||
raise_on_failed_trial=False)
|
||||
""".format(
|
||||
redis_address=cluster.redis_address,
|
||||
address=cluster.address,
|
||||
checkpoint_dir=dirpath,
|
||||
fail_class_code=reformatted,
|
||||
fail_class=_Mock.__name__)
|
||||
|
||||
@@ -40,7 +40,7 @@ search_space = {
|
||||
}
|
||||
|
||||
# Uncomment this to enable distributed execution
|
||||
# `ray.init(redis_address=...)`
|
||||
# `ray.init(address=...)`
|
||||
|
||||
analysis = tune.run(train_mnist, config=search_space)
|
||||
# __eval_func_end__
|
||||
|
||||
Reference in New Issue
Block a user