Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃惁馃洃 Early stopping: Reload weights from best epoch #961

Merged
merged 16 commits into from
Jun 6, 2022

Conversation

mberr
Copy link
Member

@mberr mberr commented Jun 1, 2022

This PR re-loads the weights from the best epoch when training is stopped.

@mberr mberr changed the title Early stopping: Reload weights from best epoch 馃惁馃洃 Early stopping: Reload weights from best epoch Jun 2, 2022
@mberr mberr marked this pull request as ready for review June 2, 2022 12:15
@mberr mberr requested review from cthoyt and migalkin and removed request for cthoyt June 3, 2022 14:24
@migalkin
Copy link
Member

migalkin commented Jun 6, 2022

Tried on the combination with NodePiece on the ILPC'22 small dataset (20 epochs, patience of 3 epochs) - basically works 馃帀 .

Ideally, one needs to add a 'normal' path to the EarlyStopper (didn't try it with the pipeline) like

stopper = EarlyStopper(
    ...,
    best_model_path="/some/path/temp.pth"
)

otherwise it creates a file in the tempdir which results in a hardly every reachable folder like

/var/folders/hb/l6bdhpf92zb3ytwwsj5xblym0000gn/T/best-model-weights-6d0f2c81-6076-4e32-b4fc-90cc48f35718.pt

I am not sure if such temp folder will be automatically cleaned or this file will remain there forever (which is a waste of space).
So maybe out of convenience reasons we could create an early stopper folder in user's PYKEEN_HOME and dump it there for easier cleanup?

@mberr
Copy link
Member Author

mberr commented Jun 6, 2022

Following your suggestion, I

  • changed the default checkpoint path to something inside PYKEEN_CHECKPOINTS (cf. 7f976e2)
  • added an option to delete the file with the best weights after termination, which is enabled by default (cf. e316b44)

I also

  • fixed an error where the inductive mode was not passed to the evaluator
  • moved tests around - no big changes here

which blows up the diff a bit 馃槄

Copy link
Member

@migalkin migalkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@mberr mberr marked this pull request as draft June 6, 2022 16:12
@mberr mberr marked this pull request as ready for review June 6, 2022 16:12
@mberr mberr enabled auto-merge (squash) June 6, 2022 16:20
@mberr mberr merged commit db0056a into master Jun 6, 2022
@mberr mberr deleted the early-stopping-keep-best branch June 6, 2022 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants