Strange problem regarding model save_weights
See original GitHub issueI’m running keras on a remoter server with SSH, training LSTM, the training process works correctly, the model is like this:
model = Sequential()
model.add(Masking(mask_value=0., input_shape=(None, len(chars))))
model.add(LSTM(4000, return_sequences=True))
model.add(LSTM(4000, return_sequences=True))
model.add(TimeDistributed(Dense(len(chars))))
model.add(Activation('softmax'))
rmsprop=RMSprop(lr=0.006)
model.compile(loss='categorical_crossentropy', optimizer=rmsprop)
after I training, I saved the model:
json_string = model.to_json()
open('my_model_architecture21.json', 'w').write(json_string)
model.save_weights('my_model_weights21.h5',overwrite=True)
but this part works abnormally, as when I reload weights after training, the model works like never been trained, the same script works correctly in my one laptop. this is really strange, anyone have an idea? thanks very much!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Error in loading the model with load_weights in Keras
You are saving the weights, not the whole model. A Model is more than just the weights, including architecture, losses, metrics and etc....
Read more >Save and load models | TensorFlow Core
Model progress can be saved during and after training. This means a model can resume where it left off and avoid long training...
Read more >How to Checkpoint Deep Learning Models in Keras
Checkpoint the weights for best model on validation accuracy ... One way to address this problem is to overestimate the number of epochs....
Read more >Nengo DL converter - Deep Learning
An alternative is to define your model as usual, and then use model.save_weights and model.load_weights to save and load the weights. I'm not ......
Read more >Training new dense layers not training at all resulting 0.5 ...
My problem is that the training does not even start to converge and in fact seems to ... model.save_weights(models_path+“vgg16_conv.h5”) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
why you don not use these lines of code:
1- save the model: model.save(path+‘\name.hdf5’)
2- load the model: from keras.models import load_model
model=load_model(path+‘\name.hdf5’)
On Wed, Jan 4, 2017 at 9:28 AM, MrWanter notifications@github.com wrote:
– _________________ Hany A. EL-Ghaish
E-JUST University *PhD Candidate at School of Communication and Computer Engineering, Egypt-Japan University of Science and Technology * M. 01004393715
Facing the same issue #4875 But for me it is working fine if it is in same session. Even model.save() doesn’t seem to be working in this matter.