-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.py
executable file
·50 lines (41 loc) · 1.38 KB
/
main.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
#!/usr/bin/env python3
import os
from scripts.generative import train, test, generate_data, novelty, qualitative
from scripts.bayesopt import optimize_bayesian
from scripts.grid import run_grid
from util.error import UnknownArgumentError
from util.predefined import predefined
from util.display import print_flags
from util.settings import parse_arguments
osp = os.path
__author__ = "Tom Pelsmaeker"
__copyright__ = "Copyright 2020"
def main():
opt, parser = parse_arguments()
opt = predefined(opt)
print_flags(opt)
if not osp.isdir(opt.out_folder):
os.makedirs(opt.out_folder)
if opt.script == 'generative':
if opt.mode == 'train':
train(opt)
elif opt.mode == 'test':
test(opt)
elif opt.mode == 'generate':
generate_data(opt)
elif opt.mode == 'novelty':
novelty(opt)
elif opt.mode == 'qualitative':
qualitative(opt)
else:
raise UnknownArgumentError(
"--mode not recognized, please choose: [train, test, generate, qualitative, novelty].")
elif opt.script == 'bayesopt':
optimize_bayesian(opt, parser)
elif opt.script == 'grid':
run_grid(opt, parser)
else:
raise UnknownArgumentError(
"--script not recognized, please choose: [generative, bayesopt, grid].")
if __name__ == "__main__":
main()