Open Jbru18 opened 6 years ago
Hey @Jbru18 ,
The first "error" is a Python 2 v. Python 3 difference. The second is potentially the same.
The commit here updated the argument order for newer versions of tensorflow (didn't update the README though, oops). In r0.12 and similar early versions, tf.concat
expected the axis before the list of things to concatenate. In newer versions, tf.concat
expects the axis after the list of things to concatenate.
I would also expect that using Python 3, you'll get a couple of stray errors related to the use of range(*)
. When these are passed to tensorflow as an argument (like here) you'll want to explicitly cast it as a list instead of a range/generator by using list(range(*))
.
HI Connor,
Thank you for the quick response. I did not realize that that the model was written for Python 2. I will be running the SCScore in Windows and to my knowledge Tensorflow is only available for Python 3 in Windows. I have installed the recent version of Tensorflow 1.12 which addresses the argument order, but still face the issue of updating the Python 2 syntax to Python 3. Would you have a Python 3 version available ? I made edits to standalone_model_tf and nn.py that allow me to run the standalone tensorflow model, but I am still struggling with nntrain_fingerprint. Specifically I am running into an issue with an error message for "from Queue import Empty". Any thoughts on how to address this in Python 3 ?
Thanks J
Edits:
print "text" --> print(text)
range() --> list(range())
input_.get_shape().aslist() --> input.shape().as_list()
included: os.environ['TF_CPP_MIN_LOGLEVEL'] = '2' to suppress message from OS
xrange(*) --> range
in nn.py : shape = input.shape().aslist() -->shape = input.shape.as_list()
in standalone_model_tf:
try:
import cPickle as pickle
except:
import pickle
I haven't prepared a Python 3 version right now, sorry. The Empty exception class can be imported as from queue import Empty
The standalone_model_tf.py throws an error at "print "Model size: %dK" % (n/1000,)". The error is resolved by modifying the line to print (Model size: %dK" % (n/1000,)) A second value error is thrown at line 34 File "lib\site-packages\scscore-master\scscore\standalone_model_tf.py", line 110, in
model.build()
File "lib\site-packages\scscore-master\scscore\standalone_model_tf.py", line 34, in build
self.mol_hiddens = tf.nn.relu(linearND(self.input_mol, hidden_size, scope="encoder0"))
....
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 1) - got shape [1], but wanted [].
Any suggestions on how to resolve this error ? The error occurs with in the following configuration:
Installed packages: h5py 2.8.0 py35h3bdd7fb_2 anaconda hdf5 1.10.2 vc14_0 [vc14] conda-forge numpy 1.15.2 py35ha559c80_0 numpy-base 1.15.2 py35h8128ebf_0 rdkit 2018.03.2 py35hc0a4591_0 conda-forge six 1.11.0 py35_1 conda-forge tensorflow 0.12.1