TypeError: Unexpected keyword argument passed to optimizer: learning_rate

前端 未结 13 1686
感情败类
感情败类 2021-02-13 04:16

I am trying to load a Keras model which was trained on an Azure VM (NC promo). But I am getting the following error.

TypeError: Unexpected keyword argumen

13条回答
  •  南旧
    南旧 (楼主)
    2021-02-13 04:43

    In my case I found the best solution is to use h5py to change name of the variable from "learning_rate" -> "lr" as suggested in the previous posts.

    import h5py
    data_p = f.attrs['training_config']
    data_p = data_p.decode().replace("learning_rate","lr").encode()
    f.attrs['training_config'] = data_p
    f.close()
    

提交回复
热议问题