-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexploitability.py
38 lines (29 loc) · 1.06 KB
/
exploitability.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
from distutils.util import strtobool
import argparse, os, yaml
import ray
from rl_games.torch_runner import Runner
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false"
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-t", "--train", required=False, help="train network", action="store_true"
)
parser.add_argument(
"-p", "--play", required=False, help="play(test) network", action="store_true"
)
parser.add_argument("-c", "--checkpoint", required=False, help="path to checkpoint")
parser.add_argument("-f", "--file", required=True, help="path to config")
os.makedirs("runs", exist_ok=True)
args = vars(parser.parse_args())
config_name = args["file"]
print("Loading config: ", config_name)
with open(config_name, "r") as stream:
config = yaml.safe_load(stream)
ray.init(object_store_memory=1024 * 1024 * 1000)
runner = Runner()
try:
runner.load(config)
except yaml.YAMLError as exc:
print(exc)
runner.run(args)
ray.shutdown()