-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts_sc2.py
More file actions
56 lines (44 loc) · 1.39 KB
/
Copy pathscripts_sc2.py
File metadata and controls
56 lines (44 loc) · 1.39 KB
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
46
47
48
49
50
51
52
53
54
55
56
# python src/main.py --collect --config=<alg> --env-config=sc2_collect with env_args.map_name=<map_name> offline_data_quality=<quality> save_replay_buffer=<whether_to_save_replay> num_episodes_collected=<num_episodes_per_collection> stop_winrate=<stop_winrate> --seed=<seed>
import subprocess
from multiprocessing import Pool
import sys
tasks = []
cmds = []
dev_id = 0
time = 0 # Avoid timestamp conflicts
cmd_tpl = "sleep {}; \
CUDA_VISIBLE_DEVICES={} \
python src/main.py \
--collect \
--config={} \
--env-config=sc2_collect \
--offline_data_quality=expert \
--num_episodes_collected=100 \
--save_model_interval=500000 \
--stop_winrate=0.9 \
--seed=1 \
--t_max=40050 \
--map_name={} \
--use_wandb=False \
"
# , (3, 2), (4, 2), (4, 3)
for map in ['3m', '2s3z']:
tasks.append(map)
for t in tasks:
for alg in ['maa2c']:
cmds.append(cmd_tpl.format(time, dev_id % 2, alg, t))
time += 3
dev_id += 1
def run_cmd(cmd):
ret = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return ret.returncode
if __name__ == '__main__':
argv = sys.argv
print("Running the following commands parallelly: ")
for cmd in cmds:
print(' ', cmd)
ret = None
# if argv[-1] != 'tc': # testcmd
# with Pool(processes=len(cmds)) as pool:
# ret = pool.map(run_cmd, cmds)
print('Programs done with return codes: ', ret)