-
Notifications
You must be signed in to change notification settings - Fork 2
/
inference.py
37 lines (25 loc) · 964 Bytes
/
inference.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 os
import yaml
import argparse
from attrdict import AttrDict
from dkt.dataloader import Preprocess
from dkt import trainer
import torch
def main(args):
device = "cuda" if torch.cuda.is_available() else "cpu"
args.device = device
preprocess = Preprocess(args)
preprocess.load_test_data(args.test_file_name)
test_data = preprocess.get_test_data()
trainer.inference_kfold(args, test_data)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--conf', default='/opt/ml/git/p4-dkt-ollehdkt/conf.yml', help='wrtie configuration file root.')
parser.add_argument('-t', '--task', default='', help='wrtie task_dir root.')
term_args = parser.parse_args()
with open(term_args.conf) as f:
cf = yaml.load(f, Loader=yaml.FullLoader)
args = AttrDict(cf)
# args = parse_args(mode='train')
os.makedirs(args.model_dir, exist_ok=True)
main(args)