Unable to load custom pretrained weight in Pytorch Lightning

Solution 1:

The reason why you're getting this error is because you are trying to load your PyTorch's model weights into the Lightning module. When saving checkpoints with Lightning you don't only save the model states but also a bunch of other info (see here).

What you are looking for is the following:

path = './ckpt/BDRAR/3000.pth'
bdrar = liteBDRAR()
bdrar.model.load_state_dict(torch.load(path))