0

I'm trying to run this code in Google Colab :

from keras import optimizers from tensorflow.keras.optimizers import Adam

for i in range(5):

print(i)
model_mix = Model(inputs=[visible, visible1], outputs=x)
adam = optimizers.Adam(lr=0.01, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False)
monitor = EarlyStopping(monitor='val_loss', min_delta=1e-3, patience=6, verbose=2, mode='auto') 
model_mix.compile(loss="mean_squared_error", optimizer=adam)
model_mix.fit(
    [x_text_train, x_img_train], y_text_train, callbacks=[checkpointer_cnn,monitor],**strong text**
    validation_data=([x_text_test, x_img_test], y_text_test),
    epochs=1000)

It worked fine before but now it is giving me an error. Can someone help me to fix it?

4

2 回答 2

0

Just remove optimizers., i.e. adam = Adam(lr=0.01, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False) It should work like this.

于 2021-10-26T19:17:08.683 回答
0

Maybe it's because of diffenert editions of keras, on keras2.8.0 try:

 adam = optimizers.adam_v2.Adam(lr=0.01, ......)
于 2022-02-16T15:03:33.690 回答