-
Notifications
You must be signed in to change notification settings - Fork 6
/
launch.py
61 lines (59 loc) · 1.58 KB
/
launch.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
import os, sys
from subprocess import Popen
import subprocess
from rllab.misc.instrument import VariantGenerator, variant
class VG(VariantGenerator):
@variant
def initnslbo(self): return [20] #[20, 30, 40]
@variant
def nslbo(self): return [3] #3
@variant
def warmniter(self): return [40] #10
@variant
def slboniter(self): return [20] #10
@variant
def piter(self): return [20] #20
@variant
def miter(self): return [100]
@variant
def atype(self): return ['gae']
@variant
def inittask(self): return ['none']
@variant
def seed(self): return [1]
@variant
def alpha(self):
return [1.0]
@variant
def adv(self):
return [1] #0:Uniform, 1:AdMRL, 2:Gaussian
@variant
def nsample(self):
return [10000]
@variant
def taskname(self):
return ['Ant2D']
skip_list = ['inittask']
variants = VG().variants()
idx = 0
for i,v in enumerate(variants):
if not os.path.exists('logs'): os.makedirs('logs')
setting = "result"
for k in v.keys():
if 'hidden_keys' in k: continue
if k in skip_list: continue
setting += f"_{k}{v[k]}"
print (setting)
cmd = ["python", "main.py"]
cmd.append(f'--setting={setting}')
for k in v.keys():
if 'hidden_keys' in k: continue
cmd.append(f"--{k}={v[k]}")
e = os.environ.copy()
e['CUDA_VISIBLE_DEVICES'] = f'{idx%4}'
idx += 1
print (cmd)
print (' '.join(cmd))
with open(f"logs/{setting}.txt", 'w') as out:
Popen(cmd, env=e, stdout=out, stderr=out, stdin=out)