Skip to content

Properly handle difference between restoring only model weights and full training state #131

Description

@joeloskarsson

The --restore_opt argument is supposed to differentiate between restoring only the model weights, and restoring the full training session, including optimizer state (this is the crucial one) and epoch number etc. This is currently implemented as a bit of a hack:

if not self.restore_opt:
opt = self.configure_optimizers()
checkpoint["optimizer_states"] = [opt.state_dict()]
that can easily start causing problems as we build on it.

A proper way to handle this in Lightning is to differentiate between instantiating the model with load_from_checkpoint and calling Trainer.fit with ckpt_path. An example implementation that could be used is given here: joeloskarsson@e7d11c9

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions