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

unable to load weights from weights.hdf5 #10

Open
govardhangdg opened this issue Oct 19, 2018 · 3 comments
Open

unable to load weights from weights.hdf5 #10

govardhangdg opened this issue Oct 19, 2018 · 3 comments

Comments

@govardhangdg
Copy link

ValueError: Dimension 1 in both shapes must be equal, but are 1024 and 2048. Shapes are [1,1024] and [1,2048]. for 'Assign' (op: 'Assign') with input shapes: [1,1024], [1,2048]. is the error being shown

@Utayaki
Copy link

Utayaki commented Oct 26, 2018

Did you change the number in model.add(LSTM(512))?

Probably, you have different numbers, in the place of 512, in predict.py and lstm.py.

Does they are the same?

@winnie334
Copy link

I might have found a solution.

Whenever your network finishes an epoch, it saves it weights to a new file, called something like 'weights-improvement-11-2.9103-bigger.hdf5'. These weights are what you want to generate a new midi. The file predict.py however, always loads in the same weights: Line 70: model.load_weights('weights.hdf5'). That is why you're getting an error.

You should be able to run the network with any number of nodes, be it 512, 256 or even 2048. You have to load in the correct weights for that, however. What I did as a temporary solution is copy the name of the newly-generated weight file, and paste it into line 70 before generating a new midi. This works, but it isn't exactly elegant. Hopefully there'll be some kind of fix soon.

@beatelite
Copy link

@winnie334's fix worked for me. Nice!

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

4 participants