saicharan2804 commited on
Commit
83d149e
·
1 Parent(s): 7a3cd73

Adding synthetic_complexity_score

Browse files
Files changed (1) hide show
  1. molgenevalmetric.py +11 -2
molgenevalmetric.py CHANGED
@@ -38,7 +38,13 @@ from fcd_torch import FCD
38
 
39
  # from SCScore import SCScorer
40
 
41
- import math
 
 
 
 
 
 
42
  import numpy as np
43
  import time
44
  import rdkit.Chem as Chem
@@ -47,6 +53,9 @@ import json
47
  import gzip
48
  import six
49
 
 
 
 
50
  score_scale = 5.0
51
  min_separation = 0.25
52
 
@@ -62,7 +71,7 @@ class SCScorer():
62
  self.score_scale = score_scale
63
  self._restored = False
64
 
65
- def restore(self, weight_path=os.path.join('model.ckpt-10654.as_numpy.json.gz'), FP_rad=FP_rad, FP_len=FP_len):
66
  self.FP_len = FP_len; self.FP_rad = FP_rad
67
  self._load_vars(weight_path)
68
  # print('Restored variables from {}'.format(weight_path))
 
38
 
39
  # from SCScore import SCScorer
40
 
41
+ '''
42
+ This is a standalone, importable SCScorer model. It does not have tensorflow as a
43
+ dependency and is a more attractive option for deployment. The calculations are
44
+ fast enough that there is no real reason to use GPUs (via tf) instead of CPUs (via np)
45
+ '''
46
+
47
+ import math, sys, random, os
48
  import numpy as np
49
  import time
50
  import rdkit.Chem as Chem
 
53
  import gzip
54
  import six
55
 
56
+ import os
57
+ project_root = os.path.dirname(os.path.dirname(__file__))
58
+
59
  score_scale = 5.0
60
  min_separation = 0.25
61
 
 
71
  self.score_scale = score_scale
72
  self._restored = False
73
 
74
+ def restore(self, weight_path=os.path.join(project_root, 'models', 'full_reaxys_model_1024bool', 'model.ckpt-10654.as_numpy.json.gz'), FP_rad=FP_rad, FP_len=FP_len):
75
  self.FP_len = FP_len; self.FP_rad = FP_rad
76
  self._load_vars(weight_path)
77
  # print('Restored variables from {}'.format(weight_path))