I got an error of AttributeError: module 'keras.optimizers' has no attribute 'rmsprop' for the below code. I am using tensorflow 2 with python 3.8.
# training
batch_size = 64
epochs=125
from keras import regularizers, optimizers
from keras.callbacks import ModelCheckpoint
checkpointer = ModelCheckpoint(filepath='model.125epochs.hdf5', verbose=1, save_best_only=True)
optimizer = keras.optimizers.rmsprop(lr=0.0003,decay=1e-6)
model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])
history = model.fit_generator(datagen.flow(x_train, y_train, batch_size=batch_size), callbacks=[checkpointer],
steps_per_epoch=x_train.shape[0] // batch_size, epochs=epochs,verbose=2,
validation_data=(x_test,y_test))
AttributeError: module 'keras.optimizers' has no attribute 'rmsprop'
Because rms should be in capitals.
optimizer = keras.optimizers.RMSprop(lr=0.0003, decay=1e-6)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With