Skip to content

Commit

Permalink
fix(clean_rl_example): use same naming conventions as in the other rl…
Browse files Browse the repository at this point in the history
… libs
  • Loading branch information
visuallization committed Feb 24, 2023
1 parent 8f7d38a commit 4d3ba14
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions examples/clean_rl_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def parse_args():
help="whether to capture videos of the agent performances (check out `videos` folder)")

# Algorithm specific arguments
parser.add_argument("--env-id", type=str, default="examples/godot_rl_JumperHard/bin/JumperHard.x86_64", #examples/godot_rl_BallChase/bin/BallChase.x86_64
parser.add_argument("--env_path", type=str, default="examples/godot_rl_JumperHard/bin/JumperHard.x86_64", #examples/godot_rl_BallChase/bin/BallChase.x86_64
help="the id of the environment")
parser.add_argument("--speedup", type=int, default=8,
help="the speedup of the godot environment")
parser.add_argument("--total-timesteps", type=int, default=1000000,
help="total timesteps of the experiments")
parser.add_argument("--learning-rate", type=float, default=3e-4,
Expand Down Expand Up @@ -75,9 +77,9 @@ def parse_args():
return args


def make_env(env_id):
def make_env(env_path, speedup):
def thunk():
env = CleanRLGodotEnv(env_path=env_id, show_window=True, speedup=8)
env = CleanRLGodotEnv(env_path=env_path, show_window=True, speedup=speedup)
return env
return thunk

Expand Down Expand Up @@ -122,7 +124,7 @@ def get_action_and_value(self, x, action=None):

if __name__ == "__main__":
args = parse_args()
run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
run_name = f"{args.env_path}__{args.exp_name}__{args.seed}__{int(time.time())}"
if args.track:
import wandb

Expand Down Expand Up @@ -151,7 +153,7 @@ def get_action_and_value(self, x, action=None):

# env setup

envs = env = CleanRLGodotEnv(env_path=args.env_id, show_window=True, speedup=8, convert_action_space=True) # Godot envs are already vectorized
envs = env = CleanRLGodotEnv(env_path=args.env_path, show_window=True, speedup=args.speedup, convert_action_space=True) # Godot envs are already vectorized
#assert isinstance(envs.single_action_space, gym.spaces.Box), "only continuous action space is supported"
args.num_envs = envs.num_envs
args.batch_size = int(args.num_envs * args.num_steps)
Expand Down

0 comments on commit 4d3ba14

Please sign in to comment.