-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecutor.py
38 lines (34 loc) · 1.36 KB
/
executor.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
# @Time : 2023.05.15
# @Author : Darrius Lei
# @Email : [email protected]
import os, logging, argparse
from lib import glb_var, callback
from lib.callback import Logger
#TODO:Notes on each algorithm
#TODO:Add algorithm:https://openai.com/research/openai-baselines-acktr-a2c
#TODO:a3c gpu
if __name__ == '__main__':
if not os.path.exists("./cache/logger"):
os.makedirs("./cache/logger");
glb_var.__init__();
#set arg
parse = argparse.ArgumentParser();
parse.add_argument('--config', '-cfg', type = str, default = None, help = 'Path of configration.');
parse.add_argument('--mode', type = str, default = 'train', help = 'Mode of operation.(train/test)');
parse.add_argument('--dev', type = bool, default = False, help = 'Enable code debugging');
args = parse.parse_args();
#set logger level by mode
log_level = logging.DEBUG if args.dev else logging.INFO;
log = Logger(
level = log_level,
filename = './cache/logger/logger.log',
)
logger = log.get_log();
glb_var.set_value('log', logger);
glb_var.set_value('dev', args.dev);
from room.work import run_work
if args.config is not None and args.mode in ['train', 'test']:
run_work(args.config, args.mode);
else:
logger.error(f'Mode [{args.mode}] is not supported.')
raise callback.CustomException('ModeError');