-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·27 lines (23 loc) · 947 Bytes
/
Copy pathtest.py
File metadata and controls
executable file
·27 lines (23 loc) · 947 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
import utils
import argparse
import json
parser = argparse.ArgumentParser("Test")
parser.add_argument("--dataset", type=str,default="uspto_tpl")
parser.add_argument("--graph_type", type=str,default="reaction_graph")
parser.add_argument("--checkpoint", type=str,default="")
parser.add_argument("--config", type=str, default="")
args = parser.parse_args()
if args.config:
config = json.loads(args.config)
utils.set_device(config)
utils.set_seed(config)
dataloader_class, model_class = utils.get_class(args.dataset,args.graph_type)
dataloader_test = dataloader_class(dataset_type=f"Test",shuffle=False,**config)
model = model_class(None, dataloader_test, None, config)
model.load(args.checkpoint)
accuracy = model.validate(validate_type = "test")
model.print_accuracy(accuracy)
else:
configs = utils.get_config(args.dataset,args.graph_type)
for config in configs:
utils.start_test(config, args)