Skip to content
Discussion options

You must be logged in to vote

load_from_checkpoint is a class function which instantiates the object with the hyper_parameters in the checkpoint and then loads the state_dict.
If done like in your proposal my_model.load_from_checkpoint(checkpoint_path="example.ckpt") similar to pytorch's load_state_dict you'd have to create the my_model object first with the hyper_parameters parsed from the checkpoint and then load the weights. load_from_checkpoint combines both.
Maybe adding a way to load the state_dict from a checkpoint into an already instantiated object without using a classmethod would make sense. Something like load_state_dict_from_checkpoint.
The alternative is to load the checkpoint and then call model.load_st…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MagicFrogSJTU
Comment options

Answer selected by awaelchli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment