Closed cjmcmurtrie closed 9 years ago
To be clear the model I used when saving those weights was identitical to the one I used when loading them:
model = Sequential()
model.add(BiDirectionLSTM(embedding_size, hidden_size, init=initialize))
model.add(Dense(hidden_size, hidden_size, init=initialize))
model.add(Activation('relu'))
model.add(RepeatVector(maxlen))
model.add(LSTM(hidden_size, hidden_size, return_sequences=True, init=initialize))
model.add(TimeDistributedDense(hidden_size, output_size, activation='softmax', init=initialize))
Ignore this, I found the problem.
@cjmcmurtrie Could you clarify what the issue was? I'm having a similar problem.
I have this same problem, and I'd like to know what the solution was.
@TELSER1 Non-Existant and/or 0 byte h5 file.
I also have this problem @cjmcmurtrie @bryan-lunt can you tell me the solution?
Maybe you can post your code up here, otherwise you may also wish to try out mozi bilstm https://github.com/hycis/Mozi/blob/master/example/imdb_bilstm.py
I think it was that my h5 file was bad.
@erlizhou It was definitely a non-existant file.
I guess it needs a separate issue on the master branch, but it seems that load_weights will create the .h5 file if it doesn't exist. I don't like that behavior.
I fixed this in my own keras repo. https://github.com/bryan-lunt/keras/tree/fix_load_weights
You can comment on my pull-request on the main keras repo. https://github.com/fchollet/keras/pull/1736
@erlizhou I am also face this problem, do you solve it?
@bryan-lunt Hello, I can't find the solution from the link that you give, can you say it again, thank you.
@south-ocean You can clone my forked git repo and see the difference between that branch and the master it was based off of. I haven't delt with Keras for quite a while. The problem I was facing (judging by my comments) was that I was trying to load an h5 file that did not exist.
@cjmcmurtrie can you please give me brief about the error how to solve it.
@cjmcmurtrie Hi, I also have the same problem, can you tell me how you fix it?
The fix to the problem I was having is right here:
https://github.com/bryan-lunt/keras/commit/c23579e059c9cd88a956b7eac9a69f7d7e276fc8
I believe that it's already been merged into the main branch of keras.
The problem ( my problem) was that if you asked for an hdf5 file that did not already exist, an empty one would be created automatically.
This change prevents that. If you don't want to change keras for that, you can write your own code that will check for the existence of the file before trying to load it with keras.
who solve the problem? who can tell me ?
It looks like there may be a problem with the load_weights method when trying to re-load the bi-directional model after a previous training session.
I can try and work with you to sort this out, what do you think the problem could be?