forked from dmitrykazhdan/Representing-Programs-with-Graphs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfer.py
More file actions
29 lines (18 loc) · 653 Bytes
/
infer.py
File metadata and controls
29 lines (18 loc) · 653 Bytes
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
from utils import vocabulary_extractor
from model.model import Model
import yaml
import sys
from utils.arg_parser import parse_input_args
def infer(task_id):
with open("config.yml", 'r') as ymlfile:
cfg = yaml.load(ymlfile)
checkpoint_path = cfg['checkpoint_path']
test_path = cfg['test_path']
token_path = cfg['token_path']
vocabulary = vocabulary_extractor.load_vocabulary(token_path)
m = Model(mode='infer', task_id=task_id, vocabulary=vocabulary)
m.infer(corpus_path=test_path, checkpoint_path=checkpoint_path)
print("Inference ran successfully...")
args = sys.argv[1:]
task_id = parse_input_args(args)
infer(task_id)