MCPcopy Create free account
hub / github.com/modelscope/modelscope / pre_load

Function pre_load

modelscope/utils/nlp/load_checkpoint.py:65–71  ·  view source on GitHub ↗
(mp_rank, load_dir, tag='')

Source from the content-addressed store, hash-verified

63
64
65def pre_load(mp_rank, load_dir, tag=''):
66 load_path = _get_ckpt_name(mp_rank, load_dir, tag)
67 checkpoint = torch.load(
68 load_path,
69 map_location=lambda storage, loc: storage,
70 weights_only=True)
71 return checkpoint['module'] if 'module' in checkpoint else checkpoint
72
73
74def _load_checkpoint(model,

Callers 2

initialize_modelMethod · 0.90
__init__Method · 0.90

Calls 2

_get_ckpt_nameFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…