-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinference.py
More file actions
executable file
·28 lines (23 loc) · 1.06 KB
/
Copy pathinference.py
File metadata and controls
executable file
·28 lines (23 loc) · 1.06 KB
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
import utils
import argparse
parser = argparse.ArgumentParser("Inference")
parser.add_argument("--dataset", type=str,default="uspto_condition")
parser.add_argument("--graph_type", type=str,default="reaction_graph")
parser.add_argument("--experiment", type=str,default="")
parser.add_argument("--checkpoint", type=str,default="")
parser.add_argument("--reactions", type=str, nargs='+',default=["C1CNCCN1.ClCCBr>>CCN1CCNCC1Cl"])
args = parser.parse_args()
config = utils.get_config(args.dataset,args.graph_type,args.experiment)
encoder_class, metadata = utils.get_encoder(args.dataset,args.graph_type,args.experiment)
dataloader_class, model_class = utils.get_class(args.dataset,args.graph_type)
utils.set_device(config)
utils.set_seed(config)
encoder = encoder_class(metadata)
dataloader = dataloader_class(load = False, **config)
model = model_class(config=config)
checkpoint = utils.get_checkpoint(config, args)
model.load(checkpoint)
batch = encoder(args.reactions)
batch = dataloader(batch)
results = model.inference(batch, metadata)
utils.print_results(args.reactions, results)