Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors while running "standalone_model_tf.py" #7

Open
Jbru18 opened this issue Nov 17, 2018 · 3 comments
Open

Errors while running "standalone_model_tf.py" #7

Jbru18 opened this issue Nov 17, 2018 · 3 comments

Comments

@Jbru18
Copy link

Jbru18 commented Nov 17, 2018

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

@connorcoley
Copy link
Owner

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(*)).

@Jbru18
Copy link
Author

Jbru18 commented Nov 19, 2018

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().as_list() --> input_.shape().as_list()
included: os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' to suppress message from OS
xrange(*) --> range
in nn.py : shape = input_.shape().as_list() -->shape = input_.shape.as_list()
in standalone_model_tf:
try:
import cPickle as pickle
except:
import pickle

@connorcoley
Copy link
Owner

I haven't prepared a Python 3 version right now, sorry. The Empty exception class can be imported as from queue import Empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants