title: Trained Keras Model fails to load with load_model
body: <p>I have trained a Keras model with Tensorflow backend. It was saved with model.save. I now want to reload the model using model_load, however, I get the following error: </p>
  
  <pre><code>Traceback (most recent call last):
  
    File "&lt;ipython-input-235-387752c910a4&gt;", line 1, in &lt;module&gt;
      load_model('MyModel.h5')
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\models.py", line 243, in load_model
      model = model_from_config(model_config, custom_objects=custom_objects)
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\models.py", line 317, in model_from_config
      return layer_module.deserialize(config, custom_objects=custom_objects)
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
      printable_module_name='layer')
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\utils\generic_utils.py", line 144, in deserialize_keras_object
      list(custom_objects.items())))
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\engine\topology.py", line 2514, in from_config
      process_layer(layer_data)
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\engine\topology.py", line 2500, in process_layer
      custom_objects=custom_objects)
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
      printable_module_name='layer')
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\utils\generic_utils.py", line 144, in deserialize_keras_object
      list(custom_objects.items())))
  
    File "C:\Anaconda\envs\tensorflow\lib\site-packages\keras\models.py", line 1367, in from_config
      if 'class_name' not in config[0] or config[0]['class_name'] == 'Merge':
  
  KeyError: 0
  </code></pre>
  
  <p>From what I read, there seems to be a bug in Keras when a model that was trained with an older version of Keras is loaded with a recent version. So there might be a version mismatch. However, I couldn't find a report that corresponds to my situation. Downgrading Keras or retraining is not an option.</p>
  
  <p>Did anyone have this issue and maybe even found a solution? I would appreciate it a lot!</p>
  
  <p>Thanks!</p>