maxhodak / keras-molecules

Autoencoder network for learning a continuous representation of molecular structures.
MIT License
519 stars 146 forks source link

Will there be problems if use Tensorflow for CPU? #63

Open simonfqy opened 7 years ago

simonfqy commented 7 years ago

I tried to run your repository on my laptop, which doesn't have an independent GPU like Nvidia. So I use tensorflow (version 1.0.0) for CPU, and I have satisfied all other requirements in the file requirements.txt. I wonder whether this could work. When I was trying to replicate the tutorial on the homepage of your repository, after successfully creating the processed.h5 under the /data folder from smiles_50k.h5 file, I tried to run the following command and got this mistake:

python train.py data/processed.h5 model.h5 --epochs 20
Using TensorFlow backend.
Traceback (most recent call last):
  File "train.py", line 59, in <module>
    main()
  File "train.py", line 37, in main
    model.create(charset, latent_rep_size = args.latent_dim)
  File "/home/simonfqy/Documents/keras-molecules/molecules/model.py", line 23, in create
    _, z = self._buildEncoder(x, latent_rep_size, max_length)
  File "/home/simonfqy/Documents/keras-molecules/molecules/model.py", line 62, in _buildEncoder
    h = Flatten(name='flatten_1')(h)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 514, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 149, in create_node
    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
  File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 409, in call
    return K.batch_flatten(x)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 825, in batch_flatten
    x = tf.reshape(x, tf.pack([-1, prod(shape(x)[1:])]))
AttributeError: 'module' object has no attribute 'pack'

Can anyone please help me with this? Is it related to my using tensorflow for CPU only?

zalperst commented 7 years ago

It is because of version incompatibility