jrzaurin / pytorch-widedeep

A flexible package for multimodal-deep-learning to combine tabular data with text and images using Wide and Deep models in Pytorch
Apache License 2.0
1.26k stars 186 forks source link

Fix: EarlyStopping does not store and restore the model #175 #176

Closed LuoXueling closed 11 months ago

LuoXueling commented 11 months ago

See issue #175

LuoXueling commented 11 months ago

Explanation of the unit test:

min_delta=1000, so EarlyStopping always stores the state_dict() of the first epoch. patience=1000 is not necessary here because n_epochs=2 but I just want to mention that, if only the deep copy thing is fixed, the bug also exists if early stopping is not triggered. Finally, the restored model should have the same validation loss as that in the first epoch.

kd1510 commented 11 months ago

Thanks for putting this together - will have time to review tomorrow if nobody else gets around to it!