SimCLR icon indicating copy to clipboard operation
SimCLR copied to clipboard

Including code for training from checkpoint

Open imjohnzakkam opened this issue 2 years ago • 1 comments

Updated the simclr.py file with including code for loading from checkpoints and other minor changes

imjohnzakkam avatar Feb 17 '23 17:02 imjohnzakkam

in load_checkpoint you start by doing a check if(os.path.exists(filepath)):

Yet you try to catch an exception when you call this function in simclr.py. It will not throw an exception because of this check, but rather fail quietly.

Better do something like

def load_checkpoint(model, filepath): try: assert os.path.exists(filepath) ckpt = torch.load(filepath) model.load_state_dict(ckpt['state_dict']) epoch = ckpt['epoch'] return model, epoch except Exception: raise InvalidCheckpointPath()

Yadino avatar Dec 11 '23 14:12 Yadino