-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
45 lines (33 loc) · 990 Bytes
/
run.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
from run_utils import *
# Self-explanatory python stuff.
import time as timer
import json
import argparse
import os
def main(config):
dump(config)
ts = timer.time()
register_env(config)
if config['train_expert']:
train_expert_policy(config)
print()
dump(config)
gen_data_from_expert(config)
print()
dump(config)
do_dagger(config)
print()
dump(config)
print('Done with all steps')
print('total time taken = %f' % (timer.time() - ts))
def dump(config):
config_file = os.path.join(config['main_dir'], 'config.json')
with open(config_file, 'w') as fp:
json.dump(config, fp)
if __name__ == '__main__':
config = DEFAULT_CONFIG
config['main_dir'] = os.path.join(DATA_DIR, '%s_%s' % (config['env_name'], config['id_post']))
ensure_dir(config['main_dir'])
config['id'] = '%s_id_%s' % (config['env_name'], config['id_post'])
config['env_id'] = ENV_ID[config['env_name']]
main(config)