-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_gymnax.py
48 lines (37 loc) · 1.11 KB
/
run_gymnax.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import argparse
import wandb
import jax.random as jrd
from gene.learning import learn_gymnax_task
from gene.utils import fail_if_not_device, load_config, validate_json
from gene.core.distances import get_df
if __name__ == "__main__":
fail_if_not_device()
parser = argparse.ArgumentParser(
prog="Gymnax running script",
description="Performs policy search using an evolutionnary strategy.",
)
parser.add_argument(
"-e",
"--env",
type=str,
default="cartpole",
choices=["cartpole", "acrobot", "pendulum"],
help="Name of the environnment",
)
parser.add_argument(
"-p",
"--project",
type=str,
default="Gymnax benchmarks",
help="Name of the wandb project",
)
args = parser.parse_args()
config = load_config(f"config/{args.env}.json")
validate_json(config)
df = get_df(config)()
wdb_run = wandb.init(
project=args.project,
config=config,
name=f"{args.env}-{config['encoding']['distance']}",
)
learn_gymnax_task(df, jrd.PRNGKey(0), config, wandb)