-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_shell3.py
executable file
·41 lines (32 loc) · 1014 Bytes
/
main_shell3.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
#!/usr/bin/env python
"""
run the main3.py file for multiple times (runs)
Author: Qiong
"""
# import os
import pickle
import sys
N_RUN = 3
i_run = 0
while i_run < N_RUN:
# execute the code for N_RUN times
print("********Run {} starts********".format(i_run))
if i_run == 0:
sys.argv = ['main.py', '--seed=1']
elif i_run == 1:
sys.argv = ['main.py', '--seed=21']
elif i_run == 2:
sys.argv = ['main.py', '--seed=42']
exec(open("main3.py").read())
# execfile('main3.py')
# os.system("python main3.py")
# f = os.popen("python main3.py")
# main3.prio_memory
# prio_memory, prio_reward = main3.train(main3.RL_prio)
# print(prio_reward)
with open("saved/prio_memo_e003_May_train_time_run{}.data".format(i_run), "wb") as fp:
pickle.dump(prio_memory, fp)
# save reward to json file
with open("saved/prio_reward_e003_May_train_time_run{}.data".format(i_run), "wb") as fp:
pickle.dump(prio_reward, fp)
i_run += 1