I have download a ckpt file from github,and I tried to load it to my model,it seems not work.Even I give a fake filename it can still run.So I suppose it is not working at all
My version of pytorch-lighting is 1.2.9,and I use resume_from_checkpoint in trainer.
Hi
1.2.9 is a bit too old for me to give good suggestions, but if I remember correctly the resume_from_checkpoint argument only used to load when you called trainer.fit(). Maybe you didn’t call fit(), maybe you are running .test().
You can alternatively load just the model weights using
model = YourModelClass.load_from_checkpoint("path/to/file")
In the recent versions of Lightning this has completely changed. Each Trainer method can load a checkpoint file through the ckpt_path argument.
# default used by the Trainer
trainer = Trainer(resume_from_checkpoint=None)
# resume from a specific checkpoint
trainer = Trainer(resume_from_checkpoint="some/path/to/my_checkpoint.ckpt")
I try to use this, but it is not working.And the version is because of the github project
saic-mdal/lama: LaMa Image Inpainting, Resolution-robust Large Mask Inpainting with Fourier Convolutions, WACV 2022 (github.com)
Actually,I have found the problem that my path was wrong .However,I have noticed that this cannot handle the situtation that the model has been changed.It can’t force the load,while torch.load has the flag “strict”,so I can just set the flag to True