I trained a keras model on google colab. Now not able to load it locally on my system.

前端 未结 3 415
梦毁少年i
梦毁少年i 2020-12-20 21:18
with open(\'2model.json\',\'r\') as f:
json = f.read()
model = model_from_json(json)
model.load_weights(\"color_tensorflow_real_mode.h5\")

I traine

3条回答
  •  自闭症患者
    2020-12-20 22:04

    1. Make sure you have the newest version of Keras and tensorflow (which are 2.4.4 and 1.11.0) by running either pip install keras tensorflow or conda install keras tensorflow.

    2. In case it is Google Colab that uses deprecated objects, you may need to use custom objects:

    from keras.utils import CustomObjectScope
    from keras.initializers import glorot_uniform
    
    with CustomObjectScope({'GlorotUniform': glorot_uniform()}):
        model = load_model('my_model.h5')
    

    Not sure if this is your case though.

提交回复
热议问题