Fix for Resuming Training gives CheckpointMismatchError #1310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to the relevant Bug(s)
This Pull request is linked to #1300. It has been resolved by modifying the file src/pykeen/training/training_loop.py.
I've also updated minor things in the following two tracker files:
Description of the Change
The problem comes when using the scheduler object from PyTorch. We can observe in the constructor whenever
last_epoch=-1
the initial_lr of the optimizer is updated.https://github.com/pytorch/pytorch/blob/a5d841ef01e615e2a654fb12cf0cd08697d12ccf/torch/optim/lr_scheduler.py#L38
Basically, this makes
str(self.optimizer).encode("utf-8")
to be different, given that we have not yet reloaded the optimizer nor the scheduler.I believe the issue can be solved by moving the checksum comparison to the end of the method
_load_state
Other changes
_write
method of theJSONResultTracker
object such that it dumps the name of the object instead of the object itself, which is not parseable https://github.com/pablo-sanchez-sony/pykeen/blob/19e1c97feeefb560ec0687fded136034f73a9105/src/pykeen/trackers/file.pyallow_val_change
allows for changing the parameters during a run.Possible Drawbacks
Verification Process
I checked the introduced changes worked in my particular case.
Release Notes
JSONResultTracker
was not able to dump python objectsallow_val_change
of wandb Tracker was a dummy variable.