-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts_lbf.py
More file actions
63 lines (43 loc) · 1.39 KB
/
Copy pathscripts_lbf.py
File metadata and controls
63 lines (43 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=qmix --env-config=gymma_collect --offline_data_quality=expert --save_replay_buffer=./replay_buffer --num_episodes_collected=100 --stop_return=0.9 --seed=1 with env_args.time_limit=50 env_args.key=lbforaging:Foraging-8x8-2p-2f-coop-v2
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 \
--transfer \
--config={} \
--env-config=gymma_transfer \
--task-config=lbf_test \
--seed=1 \
--time_limit=25 \
--t_max=50200 \
--online_t_max=10200 \
--use_wandb=True \
--wandb_note=test-transfer \
"
# , (3, 2), (4, 2), (4, 3)
for p, f in [(2, 2)]:
tasks.append(f"Foraging-5x5-{p}p-{f}f-coop-v2")
for t in tasks:
for alg in ['tr_bc']:
cmds.append(cmd_tpl.format(time, dev_id % 2, alg))
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)