Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including code for training from checkpoint #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

imjohnzakkam
Copy link

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

@Yadino
Copy link

Yadino commented Dec 11, 2023

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants