Closed 4sfaloth closed 5 years ago
Hi @4sfaloth, it's due to mxnet backend, we are using different buckets
(train
, pred
, test
) to do training and prediction. when a model is loaded from 'h5' these buckets have not been initialized. A solution now is to run prediction on any data. then save to mxnet
model = load_model('keras_model.h5')
model.predict(x_test)
save_mxnet_model(model, 'mxnet_model')
BTW, we only support h5 files trained with mxnet backend for now.
@roywei thanks for the fast response. Indeed we had found and started to use that workaround in the meantime, but I was hoping there would be a cleaner way to achieve it. Thanks for the help!
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or on the Keras Slack channel instead of opening a GitHub issue.
Thank you!
[ X] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
[X ] Check that your version of TensorFlow is up-to-date. The installation instructions can be found here.
[ X] 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).
As the title says, I am only able to export the model to mxnet format (via keras.models.save_mxnet_model) immediately after training. That is, if I run the save_mxnet_model at the end of my training script, I get the mxnet files alright. But if I tried to load the keras .h5 file from disk and then run the save_mxnet_model I get this weird error
_...lib\site-packages\keras\engine\saving.py", line 82, in save_mxnet_model pred_module = module.buckets['pred'] KeyError: 'pred'
Any ideas on what may be causing this?
I am using keras-mxnet 2.2.4.1 and mxnet 1.4.0