Hi all,
im a beginner and i tried to save and open a trained model.
This model is defined as follows:
from keras.models import Sequential
from keras.layers import LSTM
model = Sequential()
model.add(LSTM(1, input_shape=(20,1)))
model.compile(optimizer=‘rmsprop’, loss=“mse”)
model.fit(X,Y, batch_size=32, epochs=10)
I can save the model by model.save(‘xxxxxx.keras’), but i cannot get it loaded; this leads to an error:
AttributeError: ‘RMSprop’ object has no attribute ‘build’
What did i do wrong? 
Tanya
3
@Markus1006
Welcome to Tensorflow Forum!
We can try multiple workaround as below:
-
Replace below line
model.compile(optimizer=‘rmsprop’, loss=“mse”)
With this
model.compile(optimizer='rmsprop', loss='mse')
-
If the above doesn’t work, try replacing ‘rmsprop’ with ‘tf.keras.optimizers.RMSprop’
-
I have prepared a gist, refer the below link to debut the issue.
Google Colab
Let us know if this solve the problem.
1 Like
Hi Tanya,
thank you very much for your advise.
Unfortunatly, it does not work - on both of my macs by the way.
So it seems that this is a local and device based problem 
I found a workaround by saving the model to a json file:
model_json = model.to_json()
with open(“model.json”, “w”) as json_file:
json_file.write(model_json)
This works well and without problems.