shenweichen / DeepCTR-Torch

【PyTorch】Easy-to-use,Modular and Extendible package of deep-learning based CTR models.
https://deepctr-torch.readthedocs.io/en/latest/index.html
Apache License 2.0
2.95k stars 696 forks source link

Cannot restore best weights with DeepFM model #262

Open congson1293 opened 1 year ago

congson1293 commented 1 year ago

Hi, I'm using deepctr-torch 0.2.9. In my code I'm using EarlyStopping as follow:

es = EarlyStopping(monitor='loss', min_delta=0, verbose=1, patience=5, mode='min', restore_best_weights=True)
mdckpt = ModelCheckpoint(filepath='model/model.ckpt', monitor='val_mse', verbose=1,
                         save_best_only=True, mode='min')

history = model.fit(train_model_input, train[target].values, batch_size=128, epochs=100,
                    validation_split=0.1, callbacks=[es, mdckpt], verbose=2)

But when I fit my model I encountered this exception AttributeError: 'DeepFM' object has no attribute 'get_weights'. Is there anyone know the way to resolve this exception ? Thank you so much.

zanshuxun commented 1 year ago

Could you please provide your tensorflow version and the detailed error stack trace?

CFZhai commented 1 year ago

I got the same issue : My tensorflow version is 2.92 The error : image

DragonBoard commented 1 year ago

I got the same issue:: My tensorflow version is 2.11.0. And the detailed error stack trace is same as https://user-images.githubusercontent.com/119619206/213330719-1242b237-40d9-4587-83a5-2ab54659f764.png @zanshuxun