MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / load_checkpoint

Function load_checkpoint

train.py:60–68  ·  view source on GitHub ↗
(args, model, optimizer)

Source from the content-addressed store, hash-verified

58
59
60def load_checkpoint(args, model, optimizer):
61 CHECKPOINT_PATH = os.path.join(args.local_workspace, 'checkpoint_latest.pth')
62 checkpoint = torch.load(CHECKPOINT_PATH, map_location=torch.device('cpu'))
63 model.load_state_dict(checkpoint['model'])
64 optimizer.load_state_dict(checkpoint['optimizer'])
65 start_epoch = checkpoint['epoch']
66 print(colored('[MODEL]: ', 'yellow') + 'Loading the model at epoch: {:d}'.format(start_epoch))
67
68 return start_epoch + 1
69
70def train(rank, world_size, args):
71 print(f"Training on rank {rank}.")

Callers 1

trainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected