MCPcopy Create free account
hub / github.com/LeapLabTHU/DAT / load_pretrained

Function load_pretrained

utils.py:41–48  ·  view source on GitHub ↗
(ckpt_path, model, logger)

Source from the content-addressed store, hash-verified

39 return max_accuracy
40
41def load_pretrained(ckpt_path, model, logger):
42 logger.info(f"==============> Loading pretrained form {ckpt_path}....................")
43 checkpoint = torch.load(ckpt_path, map_location='cpu')
44 msg = model.load_pretrained(checkpoint['model'])
45 logger.info(msg)
46 logger.info(f"=> Loaded successfully {ckpt_path} ")
47 del checkpoint
48 torch.cuda.empty_cache()
49
50
51def save_checkpoint(config, epoch, model, max_accuracy, optimizer, lr_scheduler, logger):

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 1

load_pretrainedMethod · 0.80

Tested by

no test coverage detected