-
Notifications
You must be signed in to change notification settings - Fork 5
/
predict.py
37 lines (25 loc) · 1.03 KB
/
predict.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
import argparse
import sys
from scheduler import get_predictor
from utils.config import update_options, options, reset_options
def parse_args():
parser = argparse.ArgumentParser(description='Prediction Entrypoint')
parser.add_argument('--options', help='experiment options file name', required=False, type=str)
args, rest = parser.parse_known_args()
if args.options is None:
print("Running without options file...", file=sys.stderr)
else:
update_options(args.options)
parser.add_argument('--batch-size', help='batch size', type=int)
parser.add_argument('--checkpoint', help='trained model file', type=str)
# parser.add_argument('--folder', required=True, type=str)
parser.add_argument('--name', help='model name', type=str)
args = parser.parse_args()
return args
def main():
args = parse_args()
logger, writer = reset_options(options, args, phase='predict')
predictor = get_predictor(options, logger, writer)
predictor.predict()
if __name__ == "__main__":
main()