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

Issue when sampling with pretrained model - ValueError : axes don't match array #79

Open
brentkuenzi opened this issue Jul 17, 2018 · 2 comments

Comments

@brentkuenzi
Copy link

Hello, I've been trying to test out the autoencoder using the pre-trained model and examples in the readme. I pre-processed both the 50k and 500k datasets and get the same error with both. Has anyone also experienced this error?

python sample.py data/processed_500k.h5 data/model_500k.h5 --target autoencoder

Traceback (most recent call last):
File "sample.py", line 97, in
main()
File "sample.py", line 90, in main
autoencoder(args, model)
File "sample.py", line 44, in autoencoder
model.load(charset, args.model, latent_rep_size = latent_dim)
File "/Users/brentkuenzi/Documents/GitHub/keras-molecules/molecules/model.py", line 95, in load
self.create(charset, weights_file = weights_file, latent_rep_size = latent_rep_size)
File "/Users/brentkuenzi/Documents/GitHub/keras-molecules/molecules/model.py", line 50, in create
self.autoencoder.load_weights(weights_file)
File "/Users/brentkuenzi/anaconda2/lib/python2.7/site-packages/keras/engine/network.py", line 1180, in load_weights
f, self.layers, reshape=reshape)
File "/Users/brentkuenzi/anaconda2/lib/python2.7/site-packages/keras/engine/saving.py", line 916, in load_weights_from_hdf5_group
reshape=reshape)
File "/Users/brentkuenzi/anaconda2/lib/python2.7/site-packages/keras/engine/saving.py", line 675, in preprocess_weights_for_loading
weights[0] = np.transpose(weights[0], (3, 2, 0, 1))
File "/Users/brentkuenzi/anaconda2/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 575, in transpose
return _wrapfunc(a, 'transpose', axes)
File "/Users/brentkuenzi/anaconda2/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 52, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
ValueError: axes don't match array

@tavalenzuelag
Copy link

Hi, I have the same problem right now. could you solve it?. I have suspicions that this may be due to the different charsets in the database that was used for the training compared to the one used to perform the encoder.
if someone solved this problem I would really appreciate an answer!

@tavalenzuelag
Copy link

Hi,
I already solved the problem. I did this by saving the charset occupied by the trained data and forced this to be the charset of the data set to which the autoencoder will be performed.

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