From b93de49d58b18c6bcb320fd36efcb77a6fe04b85 Mon Sep 17 00:00:00 2001 From: sgillen Date: Mon, 12 Oct 2020 13:26:00 -0700 Subject: [PATCH 1/2] update ars.py and README to reflect changes in ray, gym API --- README.md | 4 ++-- code/ars.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5c36a832..11d210c9 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@ For more information on Ray see http://ray.readthedocs.io/en/latest/. First start Ray by executing a command of the following form: ``` -ray start --head --redis-port=6379 --num-workers=18 +ray start --head ``` This command starts multiple Python processes on one machine for parallel computations with Ray. -Set "num_workers=X" for parallelizing ARS across X CPUs. +Set "--num_cpus=X" for parallelizing ARS across X CPUs. For parallelzing ARS on a cluster follow the instructions here: http://ray.readthedocs.io/en/latest/using-ray-on-a-large-cluster.html. We recommend using single threaded linear algebra computations by setting: diff --git a/code/ars.py b/code/ars.py index 2141d261..f9651a1f 100644 --- a/code/ars.py +++ b/code/ars.py @@ -386,7 +386,7 @@ def run_ars(params): if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() - parser.add_argument('--env_name', type=str, default='HalfCheetah-v1') + parser.add_argument('--env_name', type=str, default='HalfCheetah-v2') parser.add_argument('--n_iter', '-n', type=int, default=1000) parser.add_argument('--n_directions', '-nd', type=int, default=8) parser.add_argument('--deltas_used', '-du', type=int, default=8) @@ -407,7 +407,7 @@ def run_ars(params): parser.add_argument('--filter', type=str, default='MeanStdFilter') local_ip = socket.gethostbyname(socket.gethostname()) - ray.init(redis_address= local_ip + ':6379') + ray.init(address= 'auto') args = parser.parse_args() params = vars(args) From 60dccf0ab9da5f59af0a14c2f7aa72738060ba83 Mon Sep 17 00:00:00 2001 From: sgillen Date: Wed, 29 Sep 2021 16:21:12 -0700 Subject: [PATCH 2/2] another minor change for newer gym version --- code/ars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ars.py b/code/ars.py index f9651a1f..eaa9e3e1 100644 --- a/code/ars.py +++ b/code/ars.py @@ -99,7 +99,7 @@ def do_rollouts(self, w_policy, num_rollouts = 1, shift = 1, evaluate = False): # for evaluation we do not shift the rewards (shift = 0) and we use the # default rollout length (1000 for the MuJoCo locomotion tasks) - reward, r_steps = self.rollout(shift = 0., rollout_length = self.env.spec.timestep_limit) + reward, r_steps = self.rollout(shift = 0., rollout_length = self.env.spec.max_episode_steps) rollout_rewards.append(reward) else: