-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 828 Bytes
/
main.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 config.defaults import get_cfg_defaults
from environment import make_env
from algo import make_algo
import argparse
def main():
parser = argparse.ArgumentParser(description="HJxB")
parser.add_argument(
"--config-file",
default="",
metavar="file",
help="path to yaml config file",
type=str,
)
parser.add_argument(
"--opts",
help="Modify config options using the command-line",
default=[],
nargs=argparse.REMAINDER,
)
args = parser.parse_args()
# build the config
cfg = get_cfg_defaults()
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
env = make_env(cfg)
algo = make_algo(cfg, env)
algo.train(cfg.TRAIN.ITERATIONS)
if __name__ == '__main__':
main()