mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 09:41:11 +08:00
Test example applications and rllib in jenkins tests. (#707)
* Test example applications in Jenkins. * Fix default upload_dir argument for Algorithm class. * Fix evolution strategies. * Comment out policy gradient example which doesn't seem to work. * Set --env-name for evolution strategies.
This commit is contained in:
committed by
Philipp Moritz
parent
4349f1f966
commit
80e8426b5e
@@ -17,7 +17,9 @@ if __name__ == "__main__":
|
||||
parser.add_argument("--redis-address", default=None, type=str,
|
||||
help="The Redis address of the cluster.")
|
||||
parser.add_argument("--num-workers", default=4, type=int,
|
||||
help="The number of A3C workers to use>")
|
||||
help="The number of A3C workers to use.")
|
||||
parser.add_argument("--iterations", default=-1, type=int,
|
||||
help="The number of training iterations to run.")
|
||||
|
||||
args = parser.parse_args()
|
||||
ray.init(redis_address=args.redis_address, num_cpus=args.num_workers)
|
||||
@@ -27,6 +29,8 @@ if __name__ == "__main__":
|
||||
|
||||
a3c = A3C(args.environment, config)
|
||||
|
||||
while True:
|
||||
iteration = 0
|
||||
while iteration != args.iterations:
|
||||
iteration += 1
|
||||
res = a3c.train()
|
||||
print("current status: {}".format(res))
|
||||
|
||||
@@ -67,7 +67,7 @@ class Algorithm(object):
|
||||
TODO(ekl): support checkpoint / restore of training state.
|
||||
"""
|
||||
|
||||
def __init__(self, env_name, config, upload_dir="file:///tmp/ray"):
|
||||
def __init__(self, env_name, config, upload_dir=None):
|
||||
"""Initialize an RLLib algorithm.
|
||||
|
||||
Args:
|
||||
@@ -77,6 +77,7 @@ class Algorithm(object):
|
||||
should be placed. Can be local like file:///tmp/ray/ or on S3
|
||||
like s3://bucketname/.
|
||||
"""
|
||||
upload_dir = "file:///tmp/ray" if upload_dir is None else upload_dir
|
||||
self.experiment_id = uuid.uuid4()
|
||||
self.env_name = env_name
|
||||
self.config = config
|
||||
|
||||
@@ -21,6 +21,8 @@ if __name__ == "__main__":
|
||||
help="The stepsize to use.")
|
||||
parser.add_argument("--redis-address", default=None, type=str,
|
||||
help="The Redis address of the cluster.")
|
||||
parser.add_argument("--iterations", default=-1, type=int,
|
||||
help="The number of training iterations to run.")
|
||||
|
||||
args = parser.parse_args()
|
||||
num_workers = args.num_workers
|
||||
@@ -30,11 +32,13 @@ if __name__ == "__main__":
|
||||
ray.init(redis_address=args.redis_address,
|
||||
num_workers=(0 if args.redis_address is None else None))
|
||||
|
||||
config = DEFAULT_CONFIG._replace(
|
||||
num_workers=num_workers,
|
||||
stepsize=stepsize)
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config["num_workers"] = num_workers
|
||||
config["stepsize"] = stepsize
|
||||
|
||||
alg = EvolutionStrategies(env_name, config)
|
||||
while True:
|
||||
iteration = 0
|
||||
while iteration != args.iterations:
|
||||
iteration += 1
|
||||
result = alg.train()
|
||||
print("current status: {}".format(result))
|
||||
|
||||
@@ -21,12 +21,16 @@ if __name__ == "__main__":
|
||||
help="Run the script inside of tf-dbg.")
|
||||
parser.add_argument("--load-checkpoint", default=None, type=str,
|
||||
help="Continue training from a checkpoint.")
|
||||
parser.add_argument("--iterations", default=None, type=int,
|
||||
help="The number of training iterations to run.")
|
||||
|
||||
args = parser.parse_args()
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config["use_tf_debugger"] = args.use_tf_debugger
|
||||
if args.load_checkpoint:
|
||||
if args.load_checkpoint is not None:
|
||||
config["load_checkpoint"] = args.load_checkpoint
|
||||
if args.iterations is not None:
|
||||
config["max_iterations"] = args.iterations
|
||||
|
||||
ray.init(redis_address=args.redis_address)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user