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
Import as mentioned below,
import keras
from keras.models import load_model
from keras.models import Sequential
I resolved it by reinstalling the tensorflow library (with an updated version) and also placed the nvcuda.dll file under system32 folder.
I had the same problem. Using Keras version 2.3.1 and TensorFlow-GPU version 1.13, I had to upgrade Tensorflow-GPU to version 1.15
pip uninstall tensorflow-gpu
pip install tensorflow-gpu==1.15
I am also experiencing this when I try to load my model on another machine. Also trained the initial modal on an azure VM. I have tried the suggestions above and can't figure out what is causing it. Any other thoughts? Below is my code to train the model.
Models were trained and are being used in my api projects using the following versions: keras 2.3.0 tensorflow 1.14.0
history = model.fit(X, y,validation_split=0.1, \
epochs=20, \
batch_size=1000, \
class_weight = cw)
This happened to me too. Most likely because the learning_rate
was renamed from version 2.2.* to 2.3.0 in September 2018.
(see release notes: https://github.com/keras-team/keras/releases :
Rename lr to learning_rate for all optimizers. )
This worked for me:
sudo pip install keras --upgrade
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()