-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
RuntimeError: Unable to create attribute (Object header message is too large) #6766
Comments
I made a similar post on SE, which has a reward... If that would tempt you.. https://stackoverflow.com/questions/44198201/callbackfunction-modelcheckpoint-causes-error-in-keras |
You can It could be that there is something weird in your json. Inspect Cheers |
Just put together a PR for saving model weights and optimizer weights but not configuration. When you want to load, first instantiate and compile the model as you did when you were going to train it, then use You could use it something like this: from keras.callbacks import LambdaCallback
from keras_contrib.utils.save_load_utils import save_all_weights, load_all_weights
# do some stuff to create and compile model
# use `save_all_weights` as a callback to checkpoint your model and optimizer weights
model.fit(..., callbacks=[LambdaCallback(on_epoch_end=lambda epoch, logs: save_all_weights(model, "checkpoint-{:05d}.h5".format(epoch))])
# use `load_all_weights` to load model and optimizer weights into an existing model
# if not compiled (no `model.optimizer`), this will just load model weights
load_all_weights(model, 'checkpoint-1337.h5') Cheers |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
Unfixed issues shouldn't be ever marked as closed. But it seems the issue is with the h5 package. |
How to modify your code to just save the best weights AND not every instance? |
###USE get_weights AND set_weights TO SAVE AND LOAD MODEL, RESPECTIVELY. ############################################################################## #Assuming that this is your model architecture. However, you may use ################################################################################ #now, use pickle to save your model weights, instead of .h5 ################################################################################ pklfile= "D:/modelweights.pkl"
except:
restoredmodel= mymodel() ################################################################################ |
open this drive link and read the same above code properly: https://drive.google.com/open?id=1xzrqP7ExTmJiZqVt0A_G6AT69EbIjEI9tUDLD1twqj8 |
I seem to get this error when I am using the callback function modelcheckpoint..
I saw from a different issue(#5253) that, that the error could be due to a large network architecture.. Which is also my case.
But how should i then save the model, I can save the model using yaml or json but what about the weight? how can i store them if the model is too large?
https://gist.github.com/Miail/00256b6ddcad65438f3d5c982037060f
Please run script as such:
python mini.py yesno 50 40 8 1
full traceback:
https://pastebin.com/raw/NdWMPfMH
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
The text was updated successfully, but these errors were encountered: