import torch


def load_pretrained_model(model, opt):
    """ Load model weights from disk into the model that sits in main memory. """
    ckpt_dict = torch.load(opt.model_fpath)
    ckpt_state = ckpt_dict['state']
    print ('loaded ckpt with accuracy: ', ckpt_dict['acc'])
    model.load_state_dict(ckpt_state)
    return model