-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathablations_interp.py
68 lines (47 loc) · 2.63 KB
/
ablations_interp.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
62
63
64
from os import system
PROJECT_PATH = 'path_to_your_project'
ACTIVATE_VENV = '. path_to_your_virtualenv/bin/activate'
def tmux(command):
system(f'tmux ' + command)
def tmux_shell(command, session):
# print(f'send-keys -t ' + session + '.0 ' + command + ' ENTER')
command = command.replace(' ', ' Space ')
tmux(f'send-keys -t ' + session + '.0 ' + command + ' ENTER')
dataset = 'wheel'
import time
train = True
dataset_list = ['aleks-teapot', 'torchocolate', 'hand', 'lemon', 'chickchicken']
import waitGPU
for j in range(1):
experiments = [
f'{dataset_list[0]}/base-{dataset_list[0]}-interp',
f'{dataset_list[1]}/base-{dataset_list[1]}-interp',
f'{dataset_list[2]}/base-{dataset_list[2]}-interp',
f'{dataset_list[3]}/base-{dataset_list[3]}-interp',
f'{dataset_list[4]}/base-{dataset_list[4]}-interp'
]
configs = [
f'--config configs/interp_dataset/{dataset_list[0]}.py --interp_dataset 1 --wreg 1 --interp 1 --kernel linear --smoothing 0.5',
f'--config configs/interp_dataset/{dataset_list[1]}.py --interp_dataset 1 --wreg 1 --interp 1 --kernel linear --smoothing 0.5',
f'--config configs/interp_dataset/{dataset_list[2]}.py --interp_dataset 1 --wreg 1 --interp 1 --kernel linear --smoothing 0.5',
f'--config configs/interp_dataset/{dataset_list[3]}.py --interp_dataset 1 --wreg 1 --interp 1 --kernel linear --smoothing 0.5',
f'--config configs/interp_dataset/{dataset_list[4]}.py --interp_dataset 1 --wreg 1 --interp 1 --kernel linear --smoothing 0.5'
]
#print(f'Training {dataset_list[i]} and {dataset_list[i+1]}')
for i, exp in enumerate(experiments):
session = exp.split('/')[-1].partition('-')[-1] #
cmd_create_session = f'new -d -s {session}'
tmux(cmd_create_session)
tmux_shell(f'cd {PROJECT_PATH}', session)
tmux_shell('source activate pytorch', session)
tmux_shell(f'python run.py {configs[i]} --gpunum {i} --expname {exp}', session)
for i, exp in enumerate(experiments):
session = exp.split('/')[-1].partition('-')[-1]
tmux_shell(f'cd {PROJECT_PATH}', session)
tmux_shell('source activate pytorch', session)
tmux_shell(f'python run.py {configs[i]} --render_test --render_only --eval_psnr --gpunum {i} --expname {exp}', session)
time.sleep(5*60)
#check the gpu memory usage
# tmux_shell('python run.py --config configs/iphone_dataset/paper-windmill/base-paper-windmill.py --render_test --render_only --eval_psnr --gpunum 0 --expname paper-windmill/base-paper-wind
# stop tmux session
# tmux_shell('exit', session)