TypeError: Unexpected keyword argument passed to optimizer: learning_rate

前端 未结 13 1607
感情败类
感情败类 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 05:00

    That issue usual on dependencies difference between the kernel where that model has been trained and the dependencies versions where the model is being loaded.

    If you have installed the latest version of Tensorflow now (2.1) try to load the model like this:

    import tensorflow as tf
    print(tf.__version__)
    print("Num GPUs Available: ", 
           len(tf.config.experimental.list_physical_devices('GPU')))
    # Checking the version for incompatibilities and GPU list devices 
    # for a fast check on GPU drivers installation. 
    
    model_filepath = './your_model_path.h5'
    
    model = tf.keras.models.load_model(
        model_filepath,
        custom_objects=None,
        compile=False
    )
    

    Compile=False only if the model has already compiled.

提交回复
热议问题