"KeyError: 0" when trying to load a sequential model in Keras

What Keras version are you using? If it is 2.1.6 then try Keras 2.2.4 or newer and your problem will be gone. It happened to me.


It sounds like you may be trying to load a saved model using a version of Keras incompatible with the version you used for saving the model.

What versions are you using in each case? You can check using:

import keras
print(keras.__version__)

It may be that the fix for you would be to upgrade you version of Keras.


It is because of keras version mismatch.Check the versions before proceeding. Build a virtual env with all compatible version. Try using keras 2.2.4