-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathop_cli.py
52 lines (43 loc) · 2.15 KB
/
op_cli.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
"""
This file is part of the OpenProtein project.
For license information, please see the LICENSE file in the root directory.
"""
import argparse
import importlib
import sys
import torch
from dashboard import start_dashboard_server
from util import write_out
def main():
parser = argparse.ArgumentParser(
description="OpenProtein version 0.1",
conflict_handler='resolve')
parser.add_argument('--silent', dest='silent', action='store_true',
help='Dont print verbose debug statements.')
parser.add_argument('--hide-ui', dest='hide_ui', action='store_true',
default=False, help='Hide loss graph and '
'visualization UI while training goes on.')
parser.add_argument('--evaluate-on-test', dest='evaluate_on_test', action='store_true',
default=False, help='Run model of test data.')
parser.add_argument('--use-gpu', dest='use_gpu', action='store_true',
default=False, help='Use GPU.')
parser.add_argument('--eval-interval', dest='eval_interval', type=int,
default=10, help='Evaluate model on validation set every n minibatches.')
parser.add_argument('--min-updates', dest='minimum_updates', type=int,
default=2000, help='Minimum number of minibatch iterations.')
parser.add_argument('--minibatch-size', dest='minibatch_size', type=int,
default=16, help='Size of each minibatch.')
parser.add_argument('--experiment-id', dest='experiment_id', type=str,
default="example", help='Which experiment to run.')
args, _ = parser.parse_known_args()
if args.hide_ui:
write_out("Live plot deactivated, see output folder for plot.")
use_gpu = args.use_gpu
if use_gpu and not torch.cuda.is_available():
write_out("Error: --use-gpu was set, but no GPU is available.")
sys.exit(1)
if not args.hide_ui:
# start web server
start_dashboard_server()
experiment = importlib.import_module("experiments." + args.experiment_id)
experiment.run_experiment(parser, use_gpu)