Can't load ckpt
AndrewTal opened this issue · 4 comments
AndrewTal commented
AndrewTal commented
aiyolo commented
yes, ckpt['state_dict'] saves the model's parameters. The way that pytorch lightning load checkpoint is different from pytorch, you should try the following code instead:
from torchvision import models
resnet = models.resnet50(pretrained=False)
cfg = dict(
net=resnet,
image_size = 256,
hidden_layer = 'avgpool',
projection_size = 256,
projection_hidden_size = 4096,
moving_average_decay = 0.99
)
model = SelfSupervisedLearner.load_from_checkpoint(
'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
)
wencc-ucas commented
model = SelfSupervisedLearner.load_from_checkpoint(
'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
)
when I tried this, I got another issue:" TypeError: load_from_checkpoint() got an unexpected keyword argument 'net'"
Deleted user commented
model = SelfSupervisedLearner.load_from_checkpoint(
'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
)when I tried this, I got another issue:" TypeError: load_from_checkpoint() got an unexpected keyword argument 'net'"
yes, I got this issue too.